|
-
Sep 7th, 2006, 06:10 PM
#1
Thread Starter
Lively Member
Help with Dataset update
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 Code:
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
Last edited by Xcoder; Sep 8th, 2006 at 08:17 AM.
-
Sep 7th, 2006, 06:25 PM
#2
Re: Help with Dataset update
what does the error massage says?
Last edited by VBDT; Sep 7th, 2006 at 06:50 PM.
-
Sep 7th, 2006, 06:28 PM
#3
Re: Help with Dataset update
And what is the "general"? is it a table? I don't see that table on the top statments!
Last edited by VBDT; Sep 7th, 2006 at 06:32 PM.
-
Sep 7th, 2006, 06:49 PM
#4
Re: Help with Dataset update
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
Well! Help me to help you
-
Sep 8th, 2006, 08:19 AM
#5
Thread Starter
Lively Member
Re: Help with Dataset update
Yes, my mistake, I have fixed that here, I have it right in the code. Just a typo when I was editing this post sorry. Yes the error it says is "Syntax Error in Update Statement".
-
Sep 8th, 2006, 10:02 AM
#6
Thread Starter
Lively Member
Re: Help with Dataset update
I think the problem lays on the "general" table which is a real one, I think thats a restricted word in SQL, what can I do? manually edit the update command?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|