#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    8
    Rep Power
    0

    insert with a autonumber row


    var SQLString = "INSERT INTO table VALUES( '' ,'" + Request.Form("name") + "','"
    + strAlpha + "','', '"
    + Request.Form("email") + "', '"
    + Request.Form("userid") + "')";

    dbConnection.Execute(SQLString);


    This is jscript inserting into access2000. My table looks like this:

    id (autonumber)
    name
    date
    email
    userid

    Its the first field that causing my problems, I get a data type mismatch error. How do I insert with an auto incremented field?!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    NJ
    Posts
    428
    Rep Power
    16
    its an autonumber field. you don't need to insert anything in that field. take the leading comma out, and just insert the four items, Name, date, email, and userID.
  4. #3
  5. No Profile Picture
    I am here to share knowledge
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    India
    Posts
    83
    Rep Power
    12
    try this. this might resolve your issue

    var SQLString = "INSERT INTO table (name, date, email, userid) VALUES( '" & Request.Form("name") & "', '" & strAlpha & "','', '"
    & Request.Form("email") & "', '"
    & Request.Form("userid") & "')";
    Rahul

    Small things lead to perfection and perfection is not a small thing.

IMN logo majestic logo threadwatch logo seochat tools logo