View Full Version : update data

03-22-2007, 05:26 PM

I'm trying to update the customer's data in Access database from asp page.
But it seems like the following statement has an syntax error.

Here's the code.

StrSQL = "UPDATE tbl_users_cdn SET BusinessName='" &BusinessName & "', UserName='" &UserName & "', UserPassword='" &UserPassword & "', " & _
"Address='" &Address & "', Tel='" &Tel & "', Fax='" &Fax &"', Email='" &Email &"' WHERE ID= " & ID

Here's the error message.

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.

If somebody can tell me what's wrong in this code, I'd really appreciate it.

03-22-2007, 06:51 PM
the ID is not being passed to the string:

check where the value comes from and make sure it's being passed.

03-22-2007, 07:16 PM
Print out StrSQL to see what it contains.

In this case it looks like you either have an empty variable called ID, or your ID variable doesn't exist.

Set "Option Explicit" at the top of the page and Dim all variables before use to prevent accidentally using a variable that doesn't exist.

03-22-2007, 10:08 PM
Thank you, ghell and mehere.

By your emails, I noticed that I forgot to pass the ID from the previous page.
It's now working fine.

I really appreciate your help.