I have a mdb file and I access it through ADO.NET, from time to time I have to update an existing record, so I do this:
Dim dsDataGen As New DataSet
Dim daDataGen As OleDbDataAdapter
Dim cbDataGen As OleDbCommandBuilder
Private Sub Data_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
daDataGen = New OleDbDataAdapter("SELECT * FROM [mytable]", strConnConfig)
daDataGen.MissingSchemaAction = MissingSchemaAction.AddWithKey
daDataGen.Fill(dsDataGen, "general")
cbDataGen = New OleDbCommandBuilder(daDataGen)
End Sub
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Try
If dsDataGen Is Nothing Then Return
With dsDataGen.Tables("general")
.Rows(0)("name_e") = txt_nombre.Text
.Rows(0)("add_e") = txt_address.Text
.Rows(0)("phone_e") = txt_phone.Text
.Rows(0)("email_e") = txt_email.Text
daDataGen.Update(dsDataGen, "general")
End With
Catch ex As Exception
MessageBox.Show(ex.Message, "MyApp", MessageBoxButtons.OK)
End Try
But I get a "Syntax error in Update statement" the moment it steps out of daDataGen.Update(dsDataGen, "general") , I really dont know why. Please help [IMG]http://www.vbforums.com/images/smilies/frown.gif[/IMG]