Click to See Complete Forum and Search --> : Syntax Error


Capricorn
09-29-2003, 02:44 AM
Hi,
I have syntax error in my INSERT statement but I don't know what's wrong with it.Can someone help me fix it?

My INSERT statement:
client_data =" INSERT INTO users ( login, password ) VALUES ('" & login & "', '" & password & "')"

Ribeyed
09-29-2003, 12:25 PM
hi,
your problem in the syntax is caused by the use of reserved words for your database tables and fields. One way to solve this is to rename your database tables and fields.

tblUsers
fldLogon
fldPassword

and also don't use reserved words for variables.

fldpassword = request.form("fldpassword")
etc.

client_data =" INSERT INTO tblusers ( fldlogin, fldpassword ) VALUES ('" & fldlogin & "', '" & fldpassword & "')"


If you can't change table and field names then try this:


client_data =" INSERT INTO users ( login, [password] ) VALUES ('" & login & "', '" & password & "')"


And in future remember not to use reserved words.

Hopes this helps