Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. help! syntax error INSERT INTO..

help! syntax error INSERT INTO..

Scheduled Pinned Locked Moved Web Development
databasehelpsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bobolov
    wrote on last edited by
    #1

    Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error in INSERT INTO statement. /insert.asp, line 26 <% ' Declaring variables Dim name, address, age, income, data_source, con, sql_insert Function ChkString(string) If string = "" Then string = " " ChkString = Replace(string, "'", "''") End Function ' Receiving values from Form name = ChkString(Request.Form("name")) address = ChkString(Request.Form("address")) age = ChkString(Request.Form("age")) income = ChkString(Request.Form("income")) data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db1.mdb") sql_insert = "insert into user (name, address, age, income) values ('" & name & "', '" & address & "', '" & age & "', '" & income & "')" ' Creating Connection Object and opening the database Set con = Server.CreateObject("ADODB.Connection") con.Open data_source con.Execute sql_insert ' Done. Close the connection con.Close Set con = Nothing %> bobolov

    E 1 Reply Last reply
    0
    • B bobolov

      Error Type: Microsoft JET Database Engine (0x80040E14) Syntax error in INSERT INTO statement. /insert.asp, line 26 <% ' Declaring variables Dim name, address, age, income, data_source, con, sql_insert Function ChkString(string) If string = "" Then string = " " ChkString = Replace(string, "'", "''") End Function ' Receiving values from Form name = ChkString(Request.Form("name")) address = ChkString(Request.Form("address")) age = ChkString(Request.Form("age")) income = ChkString(Request.Form("income")) data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("db1.mdb") sql_insert = "insert into user (name, address, age, income) values ('" & name & "', '" & address & "', '" & age & "', '" & income & "')" ' Creating Connection Object and opening the database Set con = Server.CreateObject("ADODB.Connection") con.Open data_source con.Execute sql_insert ' Done. Close the connection con.Close Set con = Nothing %> bobolov

      E Offline
      E Offline
      Edbert P
      wrote on last edited by
      #2

      I believe user and name are reserved words. Try [user] and [name] instead and see if it helps, everthing else seems ok to me. "Democracy is two wolves and a sheep voting on what to have for dinner" - Ross Edbert Sydney, Australia

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups