Help with Dataset update

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2006
Posts: 3
Reputation: Xcoder is an unknown quantity at this point 
Solved Threads: 0
Xcoder Xcoder is offline Offline
Newbie Poster

Help with Dataset update

 
0
  #1
Sep 8th, 2006
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:

  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC