Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax Error on Insert

    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

  • #2
    Regular Coder
    Join Date
    Jan 2005
    Posts
    155
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I believe user is a reserved word and would require brackets around it
    Code:
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •