Bonjour,
Je bloque sur une erreur dans Visual Studio 2010.
Le but étant de paramétrer un ComboBox via un DataSet avec le résultat du précédent ComboBox.
Erreur :
Update requiert un UpdateCommand valide lors du passage de la collection DataRow avec des lignes modifiées. sur une mise à jour de DataSet.
taRequete.Update(dsRequete.TBL_Requete);
Cela fonctionne parfaitementement dans la version VB mais pas dans la version en C#.
Voici le code complet des deux versions :
Version VB
1 2 3 4 5 6 7 8 9 10 11
|
Public taIDDataSet As New IDDataSetTableAdapters.TBL_IDTableAdapter
Public dsIDDataSet As New IDDataSet
Me.taIDDataSet.Fill(dsIDDataSet.TBL_ID)
Me.dsIDDataSet.TBL_ID.Rows(0).BeginEdit()
Me.dsIDDataSet.TBL_ID.Rows(0).AcceptChanges()
Me.dsIDDataSet.TBL_ID.IDColumn.DefaultValue = Me.ComboBox1.SelectedValue
Me.dsIDDataSet.TBL_ID.Rows(0)("ID") = Me.ComboBox2.SelectedValue
Me.dsIDDataSet.TBL_ID.Rows(0).EndEdit()
Me.taIDDataSet.Update(dsIDDataSet.TBL_ID) |
Version WPF XAML C#
1 2 3 4 5 6 7 8 9
| private IDDataSet dsID = new IDDataSet();
private IDDataSetTableAdapters.TBL_IDTableAdapter taID = new IDDataSetTableAdapters.TBL_IDTableAdapter();
taID.Fill(dsID.TBL_ID);
dsID.TBL_ID.Rows[0].AcceptChanges();
dsID.TBL_ID.Rows[0].BeginEdit();
dsID.TBL_ID.Rows[0]["ID"] = this.ComboBox1.SelectedValue;
dsID.TBL_ID.Rows[0].EndEdit();
taID.Update(dsID.TBL_ID); |
Merci de votre aide.
Cordialement.
Philippe
Partager