Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Insert issue

    I have the following code in an ASP page that is processing a form to create a new user. I keep getting the following error

    Microsoft JET Database Engine (0x80040E14
    Syntax error in INSERT INTO statement

    The database is MS Access, the latest, I am able to perform select statements on it and do everything except write to the database. The insert statement created is as follows

    insert into UserTable ( UserName, Password, EmployeeID, AccessRight, EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com' ,1

    Where everything is text except, AccessRight and ProjectID which are numbers (long integer).

    I have taken care of the permissions issue, I am not sure what I am doing wrong, any help would be appreciated ! Code follow

    thank
    Car

    set dbConn = server.CreateObject("adodb.connection"
    set recLgn = server.CreateObject("adodb.RecordSet"

    ' open the connectio
    dbConn.Mode =
    dbConn.Open Application("Database"
    strDB = Application("Database"
    strSQL = "insert into UserTable ( UserName, Password, EmployeeID, AccessRight, EmailAddress, ProjectID )values"
    strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID) & "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")
    dbConn.Execute strSQ


    insert into MS Access issue Guest

  2. Similar Questions and Discussions

    1. What's faster - loop for insert or insert...select.
      What is faster if I'm moving large numbers of records (anywhere from 10,000 to 300,000 records per archive) from one query to another table? 1)...
    2. Insert Link Issue
      I've been having an issue with using 'Insert Link' - when linking to an external websites, the window freezes while trying to display a preview of...
    3. Multiple Insert or Looping Insert
      I built an application on an Access DB that allows a dispatcher to log trucks in the field at their location as they call in. There are three...
    4. Login - multi table insert for registrant; subsquent login insert page requests into joined 'Selection' Table
      Question regards insert and updates in sql server for a simple login script that requires registration the first time and only "email address" upon...
    5. INSERT statement contains fewer items than the insert list
      The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles...
  3. #2

    Default Re: Insert issue

    "insert into MS Access issue" <anonymous@discussions.microsoft.com> wrote in
    message news:661A086D-17D4-455E-9BEB-65222D71C09C@microsoft.com...
    > I have the following code in an ASP page that is processing a form to
    create a new user. I keep getting the following error:
    >
    > Microsoft JET Database Engine (0x80040E14)
    > Syntax error in INSERT INTO statement.
    >
    > The database is MS Access, the latest, I am able to perform select
    statements on it and do everything except write to the database. The insert
    statement created is as follows:
    >
    > insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
    EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com'
    ,1)
    >
    > Where everything is text except, AccessRight and ProjectID which are
    numbers (long integer).
    >
    > I have taken care of the permissions issue, I am not sure what I am doing
    wrong, any help would be appreciated ! Code follows
    >
    > thanks
    > Carl
    >
    >
    > set dbConn = server.CreateObject("adodb.connection")
    > set recLgn = server.CreateObject("adodb.RecordSet")
    >
    > ' open the connection
    > dbConn.Mode = 3
    > dbConn.Open Application("Database")
    > strDB = Application("Database")
    > strSQL = "insert into UserTable ( UserName, Password, EmployeeID,
    AccessRight, EmailAddress, ProjectID )values"
    > strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID)
    & "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")"
    > dbConn.Execute strSQL

    Have you tried inserting a Response.Write(strSQL) before the dbConn.Execute
    statement and then cut-and-paste it into an MS-Access query to see if it
    works that way?


    McKirahan Guest

  4. #3

    Default Re: Insert issue

    Password is a reserved word and should not be used as a column name. If you
    can't change it, you'll have to make the following edit to all SQL
    statements:

    INSERT ... (... , [Password], ...)

    The square brackets tell the engine to pretend it's not a reserved word,
    sort of...

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    "insert into MS Access issue" <anonymous@discussions.microsoft.com> wrote in
    message news:661A086D-17D4-455E-9BEB-65222D71C09C@microsoft.com...
    >I have the following code in an ASP page that is processing a form to
    >create a new user. I keep getting the following error:
    >
    > Microsoft JET Database Engine (0x80040E14)
    > Syntax error in INSERT INTO statement.
    >
    > The database is MS Access, the latest, I am able to perform select
    > statements on it and do everything except write to the database. The
    > insert statement created is as follows:
    >
    > insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
    > EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0, 'why@c.com'
    > ,1)
    >
    > Where everything is text except, AccessRight and ProjectID which are
    > numbers (long integer).
    >
    > I have taken care of the permissions issue, I am not sure what I am doing
    > wrong, any help would be appreciated ! Code follows
    >
    > thanks
    > Carl
    >
    >
    > set dbConn = server.CreateObject("adodb.connection")
    > set recLgn = server.CreateObject("adodb.RecordSet")
    >
    > ' open the connection
    > dbConn.Mode = 3
    > dbConn.Open Application("Database")
    > strDB = Application("Database")
    > strSQL = "insert into UserTable ( UserName, Password, EmployeeID,
    > AccessRight, EmailAddress, ProjectID )values"
    > strSQL = strSQL & " ('" & user & "' ,'" & pass & "' ,'" & CSTR(employeeID)
    > & "' , " & adminPriv & ", '" & eAddress & "' ," & nProjID & ")"
    > dbConn.Execute strSQL
    >
    >

    Aaron Bertrand [MVP] Guest

  5. #4

    Default Re: Insert issue

    insert into MS Access issue wrote:
    > I have the following code in an ASP page that is processing a form to
    > create a new user. I keep getting the following error:
    >
    > Microsoft JET Database Engine (0x80040E14)
    > Syntax error in INSERT INTO statement.
    >
    > The database is MS Access, the latest, I am able to perform select
    > statements on it and do everything except write to the database. The
    > insert statement created is as follows:
    >
    > insert into UserTable ( UserName, Password, EmployeeID, AccessRight,
    > EmailAddress, ProjectID ) values ('why' ,'why' ,'121212' , 0,
    > 'why@c.com' ,1)
    >

    Password is a reserved keyword and should not be used for a database object
    name. My recommendation is to change the name of the field, but, if you
    can't for some reason, then you will need to remember to surround it with
    brackets when using it in a query called via ADO:
    insert into UserTable ( UserName, [Password], ...

    HTH,
    bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

  6. #5

    Default Re: Insert issue

    The Password in the table column was the issue thank you I would have never found this it was driving me crazy!

    THANKS

    Carl
    Carl Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139