473,657 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax error in UPDATE statement

1 New Member
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_STRI NG As String = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=\\87-08\shareddocs\U ser.mdb"

Dim access As New OleDbConnection
access = New OleDbConnection (CONNECTION_STR ING)

Dim UpdateCommand As OleDbCommand = New OleDbCommand()
UpdateCommand.C onnection = access



UpdateCommand.C ommandText = "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.P arameters.AddWi thValue("@Id", IdComboBox.Text )

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

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

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

Similar topics

3
6222
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: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Syntax error in UPDATE statement. /polyprint/dataEntry.asp, line 158
7
248459
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 particular surname in a particular town. I can select the records fine with this syntax (testing in Oracle SQL* Plus) SELECT NAMEINFO.LASTNAME, NAMEINFO.FIRSTNAME, NAMEINFO.MIDDLENAME, NAMEINFO.GENDER, ADDRESSINFO.REGION FROM NAMEINFO, ADDRESSINFO...
5
5126
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 However if I update any other column the syntax is fine
4
5318
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 t1.sire_bhid=t2.bhid when not matched then update set t1.sire_bhid=0 go gets the error message:
4
11327
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 AddressDescription of Entity 456 = AddressDescription of Entity_ID 123 Address1 of Entity 456 = Address1 of Entity_ID 123 City of Entity 456 = City of Entity_ID 123
1
3087
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 112: MM_editCmd.ActiveConnection = MM_editConnection Line 113: MM_editCmd.CommandText = MM_editQuery Line 114: MM_editCmd.Execute
6
2684
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 person wants to receive a newsletter and 0 no, don't want to receive it. Now.....when trying to create an UPDATE statement I am running into problems writing the code for it. I had issues before with missing commas but now that the commas are there...
8
8194
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 in syntax error on Update on the statement da.update(mydataset, "DATABASENAME") I do have a primary key on both and copied the code from the working update
1
3367
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 an exception occours which is- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request.
3
4955
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 routine has got me foxed. <?PHP // update.php require("./resources/globals.php") ; require("./resources/common.php") ; //echo $detail;
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.