Results 1 to 5 of 5

Thread: INSERT INTO woes

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2002
    Posts
    19

    INSERT INTO woes

    Hello,
    I needed another set of eyes to look at this statement since mine don't seem to do it.
    I'm getting "Syntax error in INSERT INTO statement" when trying to add a row
    to an Access 2000 table.
    Happens on cmd.ExecuteNonQuery()

    "INSERT INTO details
    (County, City, Location, BegDate, EndDate, Group, Function, MeetingRoom)
    VALUES ('PINELLAS', 'CLEARWATER', 'BELLEVIEW BILTMORE RESORT & SPA', #11/18/2002#, #12/1/2002#, 'Atofina Chemicals', 'Breakfast', 'Henry''s')"

    Any ideas?
    Thanks in advance!

  2. #2
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brisbane Australia
    Posts
    150

    SQL statement

    Change the names in your database for group and Function and try again . I had similar problems when I had field names of Name and Date- changed them to EMName and EMDate and the problems went away - really meningful error messages !!!.

    hope this helps

    regards
    BH

  3. #3
    Addicted Member
    Join Date
    Jun 2002
    Location
    Brisbane Australia
    Posts
    150

    SQL statement

    Also have you tried taking out the quotes from "Henrys" to see if thats the problem ??

    BH

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Oct 2002
    Posts
    19
    I threw it into SQL Server and it gave me a better indication of what the error was. I changed Function and Group and now it goes right through.
    Thanks.
    As far as the double quotes, the entry is Henry's and you have to replace a single quote with two single quotes, otherwise your statement will end right there.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2002
    Posts
    19
    You can also enclose a word like Group in [] in the statement to avoid errors just in case you don't want to change field 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
  •  



Click Here to Expand Forum to Full Width