Salut a Tous.
je veut mettre a jour ma base de données access a partir des textbox de mon form voici mon code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Private Sub BtnModifier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnModifier.Click
Dim num = txtnum.Text
Dim int = txtint.Text
Dim ar = txtar.Text
Dim DA2 As OleDb.OleDbDataAdapter
DA2 = New OleDb.OleDbDataAdapter("Select * From Plan Where [Numéro]=" & "'" & num.ToString.Replace("'", "''") & "'", CN)
Dim DS2 As New DataSet
DA2.Fill(DS2)
Dim LaLigne As DataRow()
LaLigne = DS2.Tables("Plan").Select("Numéro=" & num)
LaLigne(0)(2) = int
LaLigne(0)(5) = ar
Dim CmdBuild As OleDb.OleDbCommandBuilder
CmdBuild = New OleDb.OleDbCommandBuilder(DA2)
DA2.UpdateCommand = CmdBuild.GetUpdateCommand()
DA2.Update(DS2, "Plan")
CN.Close()
End Sub |
Lorsque j'appuie sur le bouton pour modifier les enregistrements j'ai une exeption(" Object reference not set to an instance of an object.") au niveau de la ligne:
LaLigne = DS2.Tables("Plan").Select("Numéro=" & num)
et je vois pas ou ca cloche!
Partager