473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Syntax error in UPDATE statement

Hi,

The following code generates an error and I am not sure why. The error says syntax error in UPDATE statement. Anyone have any ideas? Your help will greatly appreciated.

Dim CONNECTION_STRING As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\87-08\shareddocs\User.mdb"

Dim access As New OleDbConnection
access = New OleDbConnection(CONNECTION_STRING)

Dim UpdateCommand As OleDbCommand = New OleDbCommand()
UpdateCommand.Connection = access



UpdateCommand.CommandText = "Update Admin Set [AcadYr] = @Ay, [ComName] = @Cn, [Sal1] = @Sa1, [Sal2] = @Sa2, [Firstname1] = @Fn1, [Firstname2] = @Fn2, [Lastname1] = @Ln1, [Lastname2] = @Ln2, [Status1] = @s1, [Status2] = @s2, [Designation1] = @Dg1, [Designation2] = @Dg2, [Add1] = @Add1, [Pcode] = @Pc, [Otel] = @Ot, [Dline1] = @D1, [Dline2] = @D2, [Faxno] = @Fn, [Email1] = @Em1, [Email2] = @Em2, [Supervisor1] = @Sp1, [Supervisor2] = @Sp2, [ProjId] = @Pi, [ProjTitle] = @Pt, [ProjCatDes] = @Pcd, [ProjCatCode] = @Pcc, [TechAreaDes] = @Tad, [Remarks] = @Rem, [Awards] =@Aw, [PDonation] =@PDon, [Year] =@Year, [TPrizes] =@Tz, [Time] =@Tim WHERE Id = @Id"

UpdateCommand.Parameters.AddWithValue("@Id", IdComboBox.Text)

UpdateCommand.Parameters.AddWithValue("@Ay", AcadYrComboBox.Text)
UpdateCommand.Parameters.AddWithValue("@Cn", TextBox32.Text)
UpdateCommand.Parameters.AddWithValue("@Sa1", ComboBox26.Text)
UpdateCommand.Parameters.AddWithValue("@Sa2", ComboBox25.Text)
UpdateCommand.Parameters.AddWithValue("@Fn1", TextBox27.Text)
UpdateCommand.Parameters.AddWithValue("@Fn2", TextBox22.Text)
UpdateCommand.Parameters.AddWithValue("@Ln1", TextBox29.Text)
UpdateCommand.Parameters.AddWithValue("@Ln2", TextBox24.Text)
UpdateCommand.Parameters.AddWithValue("@S1", ComboBox31.Text)
UpdateCommand.Parameters.AddWithValue("@S2", ComboBox32.Text)
UpdateCommand.Parameters.AddWithValue("@Dg1", TextBox28.Text)
UpdateCommand.Parameters.AddWithValue("@Dg2", TextBox23.Text)
UpdateCommand.Parameters.AddWithValue("@Add1", TextBox33.Text)
UpdateCommand.Parameters.AddWithValue("@Pc", TextBox34.Text)
UpdateCommand.Parameters.AddWithValue("@Ot", TextBox35.Text)
UpdateCommand.Parameters.AddWithValue("@D1", TextBox30.Text)
UpdateCommand.Parameters.AddWithValue("@D2", TextBox25.Text)
UpdateCommand.Parameters.AddWithValue("@Fn", TextBox36.Text)
UpdateCommand.Parameters.AddWithValue("@Em1", TextBox31.Text)
UpdateCommand.Parameters.AddWithValue("@Em2", TextBox26.Text)
UpdateCommand.Parameters.AddWithValue("@Sp1", ComboBox23.Text)
UpdateCommand.Parameters.AddWithValue("@Sp2", ComboBox22.Text)
UpdateCommand.Parameters.AddWithValue("@Pi", ComboBox21.Text)
UpdateCommand.Parameters.AddWithValue("@Pt", TextBox1.Text)
UpdateCommand.Parameters.AddWithValue("@Pcd", ComboBox18.Text)
UpdateCommand.Parameters.AddWithValue("@Pcc", ComboBox19.Text)
UpdateCommand.Parameters.AddWithValue("@Tad", ComboBox20.Text)
UpdateCommand.Parameters.AddWithValue("@Rem", TextBox19.Text)
UpdateCommand.Parameters.AddWithValue("@Aw", ComboBox17.Text)
UpdateCommand.Parameters.AddWithValue("@Id", IdComboBox.Text)
UpdateCommand.Parameters.AddWithValue("@PDon", ComboBox30.Text)
UpdateCommand.Parameters.AddWithValue("@Year", ComboBox33.Text)
UpdateCommand.Parameters.AddWithValue("@Tz", ComboBox24.Text)
UpdateCommand.Parameters.AddWithValue("@Tim", Time.Text)

access.Open()
UpdateCommand.ExecuteNonQuery() [COLOR="Red"]<== Error Here[/COLOR]
access.Close()
Jul 30 '06 #1
0 1333

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
4
by: Bob Stearns | last post by:
The statement: merge into nullid.animals_et_in t1 using is3.animals t2 on t1.sire_assoc=t2.assoc and t1.sire_prefix=t2.prefix and t1.sire_regnum=t2.regnum when matched then update set...
4
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET...
1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
8
by: Stephen Plotnick | last post by:
I have three forms and update one table in an Access DB with sucess in one form. In the other two forms I'm trying to do an update to a different table in the Access DB. The error I'm getting...
1
by: ajos | last post by:
hi evrybdy, the problem is:- i had this running before in jsp but when i changed the jsp page using struts tags there occoured a problem... when i enter values in the 2 text boxes and click enter...
3
by: phobia1 | last post by:
Hi once again. We have just changed our ISP and things that worked fine now do not, Obviously its in the differences of MYSQL and PHP versions. Have fixed most of the problems but this UPDATE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.