...

View Full Version : update data



speece
03-22-2007, 05:26 PM
Hello,

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.

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

WHERE ID= " & ID
check where the value comes from and make sure it's being passed.

ghell
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.

speece
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum