Syntax error when insert record from ASP to Access

Results 1 to 4 of 4

Thread: Syntax error when insert record from ASP to Access

  1. #1
    Gogi virk Guest

    Default Syntax error when insert record from ASP to Access

    Hi all! I am unable to insert record in Access 2000 database from my ASP page. I am using INSERT INTO sql but I am getting error saying "Syntax error in INSERT INTO statement" and error number is 2147217900. Here is my code:<BR><BR>strDbLoc="webdbdatastuff.mdb"<BR>set conn=Server.CreateObject("ADODB.Connection")<BR>co nn.connectionstring="Provider=Microsoft.Jet.OLEDB. 4.0; Data Source=" & Server.MapPath(strDbLoc)<BR> connectionstring<BR>sql = "INSERT INTO parameters (itemA, itemB, itemC) VALUES(225.5,111.21,124.87)"<BR>response.write sql <BR>conn.execute sql <BR><BR>Are there any permissions on Web Server (IIS5) to check as I can select from db using the above connection but not able to update or insert. I also tried recordset.Addnew method.<BR><BR>Appreciate your time and help.<BR><BR>Gogi Virk<BR>

  2. #2
    Join Date
    Dec 1969

    Default Nothing obvious...

    I can only see two possible problems:<BR><BR>(1) One of the fields you are specifying is *not* a numeric field (despite the fact you are stuffing a number into it), and so the value for it needs to be surrounded by &#039;...&#039;.<BR><BR>(2) "parameters" is a reserved word in Access. Just to be safe, surround it with [...].<BR><BR>See also the ASPFAQs and the topic "Databases, Queries". Though I&#039;m not sure there&#039;s anything relevant there, other than (1) as noted above.<BR><BR>

  3. #3
    Gogi Virk Guest

    Default RE: Nothing obvious...

    Thanks, you are right. I was using the keyword as my table name and it was giving the trouble. I changed it as you suggested and its ok. Thanks to you for your valuable input and thanks to for giving this platform.<BR><BR>Thanks again.<BR><BR>Gogi Virk

  4. #4
    Join Date
    Dec 1969

    Default Lucky guess!

    I didn&#039;t know that "parameters" was a keyword in Access. I really was just making a guess. Glad it worked out!<BR><BR>

Posting Permissions

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