Bonjour,
je débute en .NET 2.0.
je suis sous Windows XP + SP2 et VS 2005 Pro +SP1.
dans une programme, j'ai :
Try
Dim myDataAdapter As New OleDbDataAdapter
Dim MyDataSet As New DataSet
cn.Open()
myDataAdapter = New OleDbDataAdapter("SELECT * FROM FACTURE WHERE [id-facture] = " + id.ToString, cn)
myDataAdapter.Fill(MyDataSet, "Factures")
With MyDataSet.Tables("Factures")
.Rows(0).Item("numero") = tbNumero.Text
End With
'Pour modifier les valeurs changées dans le DataAdapter
myCommandBuilder = New OleDbCommandBuilder(myDataAdapter)
myDataAdapter.UpdateCommand = myCommandBuilder.GetUpdateCommand()
'Mise à jour
myDataAdapter.Update(MyDataSet, "Factures")
cn.Close()
Call Rafraichissement_Donnees()
tbNumero.Focus()
Catch er As Exception
Clipboard.SetText(er.ToString)
MessageBox.Show("Une erreur est survenue pendant la mise à jour." & Chr(13) & Chr(10) & _
"L'opération a échoué! : " & er.ToString, "Echec", MessageBoxButtons.OK, MessageBoxIcon.Error)
cn.Close()
End Try
sur myDataAdapter.Update(MyDataSet, "Factures"), j'ai le message d'erreur :
System.Data.OleDb.OleDbException: Aucune valeur donnée pour un ou plusieurs des paramètres requis.
à System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
à System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
à System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
à System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
à System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
id étant la clé primaire de la table de la base Access 2003
tous les champs, sauf id, peuvent avoir la valeur Null
Les données sont affichés dans des textbox, je fais des modifications et je veux enregistrer ses modifications dans la base.
Où est l'erreur ?
Merci de l'aide que vous pourriez m'apporter.