By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,982 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,982 IT Pros & Developers. It's quick & easy.

System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.

P: n/a
I have wrote this code just about every way I can think of and I still get
the above error. One thing I noticed was when I reduce the amount of fields
to be updated to about half it works, but that is not a solution. The code
is below and I give great thanks to anyone who can help me here.

Note: I have "" the memo fields thinking that it may have been a special
character issue but I still get the same resulting error message.

Sub Update_Info(Sender as Object, E as EventArgs)
Dim cnMemberUpdate as OleDbConnection
Dim strUpdate as string
Dim cmdUpdate as OleDbCommand

cnMemberUpdate = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Inetpub\wwwroot\WaucondaChamber\fpdb\mem bers list and
yp.mdb")
strUpdate = "Update MemberList Set Company=@company, Contact=@contact,
Address=@address, City=@city, State=@state, Zip=@zip, Phone=@phone,
Fax=@fax, Email=@email, Domain=@domain, Description=@description,
B2BDescription=@b2bdescription, Keywords=@keywords, UserName=@username,
Password=@password Where ID = " & tbID.Text

cmdUpdate = New OleDbCommand(strUpdate, cnMemberUpdate)
cmdUpdate.Parameters.Add("@company",tbCompany.Text )
cmdUpdate.Parameters.Add("@contact",tbContact.Text )
cmdUpdate.Parameters.Add("@address",tbAddress.Text )
cmdUpdate.Parameters.Add("@city",tbCity.Text)
cmdUpdate.Parameters.Add("@state",tbState.Text)
cmdUpdate.Parameters.Add("@zip",tbZipCode.Text)
cmdUpdate.Parameters.Add("@phone",tbTelephone.Text )
cmdUpdate.Parameters.Add("@fax",tbFax.Text)
cmdUpdate.Parameters.Add("@email","")
cmdUpdate.Parameters.Add("@domain", "")
cmdUpdate.Parameters.Add("@description", "")
cmdUpdate.Parameters.Add("@b2bdescription", "")
cmdUpdate.Parameters.Add("@username",tbUserName.Te xt)
cmdUpdate.Parameters.Add("@password",tbPassword.Te xt)
cnMemberUpdate.Open()
cmdUpdate.ExecuteNonQuery()
cnMemberUpdate.Close()
Response.Redirect("Update_Confirmation.htm")
End Sub
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Fixed problem = was reserved word issue. ACK
"Mark Sandfox" <Ma**@RestlessFox.com> wrote in message
news:70********************@newssvr28.news.prodigy .com...
I have wrote this code just about every way I can think of and I still get
the above error. One thing I noticed was when I reduce the amount of fields to be updated to about half it works, but that is not a solution. The code is below and I give great thanks to anyone who can help me here.

Note: I have "" the memo fields thinking that it may have been a special
character issue but I still get the same resulting error message.

Sub Update_Info(Sender as Object, E as EventArgs)
Dim cnMemberUpdate as OleDbConnection
Dim strUpdate as string
Dim cmdUpdate as OleDbCommand

cnMemberUpdate = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=C:\Inetpub\wwwroot\WaucondaChamber\fpdb\mem bers list and
yp.mdb")
strUpdate = "Update MemberList Set Company=@company, Contact=@contact,
Address=@address, City=@city, State=@state, Zip=@zip, Phone=@phone,
Fax=@fax, Email=@email, Domain=@domain, Description=@description,
B2BDescription=@b2bdescription, Keywords=@keywords, UserName=@username,
Password=@password Where ID = " & tbID.Text

cmdUpdate = New OleDbCommand(strUpdate, cnMemberUpdate)
cmdUpdate.Parameters.Add("@company",tbCompany.Text )
cmdUpdate.Parameters.Add("@contact",tbContact.Text )
cmdUpdate.Parameters.Add("@address",tbAddress.Text )
cmdUpdate.Parameters.Add("@city",tbCity.Text)
cmdUpdate.Parameters.Add("@state",tbState.Text)
cmdUpdate.Parameters.Add("@zip",tbZipCode.Text)
cmdUpdate.Parameters.Add("@phone",tbTelephone.Text )
cmdUpdate.Parameters.Add("@fax",tbFax.Text)
cmdUpdate.Parameters.Add("@email","")
cmdUpdate.Parameters.Add("@domain", "")
cmdUpdate.Parameters.Add("@description", "")
cmdUpdate.Parameters.Add("@b2bdescription", "")
cmdUpdate.Parameters.Add("@username",tbUserName.Te xt)
cmdUpdate.Parameters.Add("@password",tbPassword.Te xt)
cnMemberUpdate.Open()
cmdUpdate.ExecuteNonQuery()
cnMemberUpdate.Close()
Response.Redirect("Update_Confirmation.htm")
End Sub

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.