943,931 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 7856
  • VB.NET RSS
Sep 8th, 2006
0

Help with Dataset update

Expand Post »
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:

VB.NET Syntax (Toggle Plain Text)
  1. Dim dsDataGen As New DataSet
  2. Dim daDataGen As OleDbDataAdapter
  3. Dim cbDataGen As OleDbCommandBuilder
  4.  
  5. Private Sub Data_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.  
  7. daDataGen = New OleDbDataAdapter("SELECT * FROM [mytable]", strConnConfig)
  8. daDataGen.MissingSchemaAction = MissingSchemaAction.AddWithKey
  9. daDataGen.Fill(dsDataGen, "general")
  10. cbDataGen = New OleDbCommandBuilder(daDataGen)
  11.  
  12. End Sub
  13.  
  14. Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
  15.  
  16. Try
  17. If dsDataGen Is Nothing Then Return
  18.  
  19. With dsDataGen.Tables("general")
  20. .Rows(0)("name_e") = txt_nombre.Text
  21. .Rows(0)("add_e") = txt_address.Text
  22. .Rows(0)("phone_e") = txt_phone.Text
  23. .Rows(0)("email_e") = txt_email.Text
  24.  
  25. daDataGen.Update(dsDataGen, "general")
  26.  
  27. End With
  28.  
  29. Catch ex As Exception
  30. MessageBox.Show(ex.Message, "MyApp", MessageBoxButtons.OK)
  31. 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 http://www.vbforums.com/images/smilies/frown.gif
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Xcoder is offline Offline
3 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Infinite closing loop... HELP!
Next Thread in VB.NET Forum Timeline: creating an assembly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC