...

View Full Version : Syntax Error on Insert



dalezjc
04-17-2007, 02:44 PM
I read the sticky about single quote errors but I'm not sure it applies to my error, but I'm a newbie so I'm not sure.

I'm getting a syntax error on the line below when trying to do an insert into a SQL database:

set rsInsert = conn.Execute ("INSERT INTO user (lastname, firstname, grade) values ('" & lastname & "', '" & firstname & "', '" & grade & "' ")

The exact error:

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'user'.

Any help is appreciated!

Thanks

mehere
04-17-2007, 04:20 PM
I believe user is a reserved word and would require brackets around it

set rsInsert = conn.Execute ("INSERT INTO [user] (lastname, firstname, grade) values ('" & lastname & "', '" & firstname & "', '" & grade & "' ")
you should try not to use reserved words in your table and/or column names



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum