Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

asp, sql insert statement

  • 24-01-2005 2:54pm
    #1
    Registered Users, Registered Users 2 Posts: 483 ✭✭


    lo,
    im tryin to add records into a database and i was wonderin if i need to put in a value for my ID field (which is the autonumber field) in my insert sql statement!

    strSQL = "INSERT INTO Userinfo (Username,Password,FName,LName,Address,Email,Phone) VALUES ('" & Username & "','" & Password & "','" & Fname & "','" & LName & "','" & Address & "','" & Email & "','" & Phone & "')"

    when i try to execute the statement i get this message: Syntax error in INSERT INTO statement.


Comments

  • Registered Users, Registered Users 2 Posts: 3,889 ✭✭✭cgarvey


    Any of those variable values have a ' in them?

    .cg


  • Moderators, Politics Moderators Posts: 41,234 Mod ✭✭✭✭Seth Brundle


    Is phone text or integer?
    Sometimes I have found that field names 'username' and 'password' don't work until I place them in square brackets, i.e.
    "INSERT INTO Userinfo ([Username],[Password],[FName]...
    
    also read www.webthang.co.uk/tuts/tuts_dbase/rwords/pf/rwords_pf.asp


  • Registered Users, Registered Users 2 Posts: 706 ✭✭✭DJB


    Like kbannon mentioned... some field names conflict with functions and controls in vb, sql, etc. Can't remember many of them but I do remember having this problem a few years back. Solved it by using a standard for naming tables and fields in the table so that they do not conflict with these values. It's like using a variable name called "request" in asp/vb. It just ain't going to happen!!!

    Here's what I use as default for table names and field names:

    Example 1:

    TBL_USERS
    US_ID
    US_FIRST
    US_LAST
    US_USERNAME
    US_PASSWORD
    etc.

    TBL_PAGES
    PG_ID
    PG_NAME
    etc.

    That's only my own standard that I use but you could you tblUsers or tblPages and usUserId, usFirst or pgId, pgName, etc.

    Hope that makes sense. Try it and see how you get on :)


Advertisement