Database Error

Results 1 to 2 of 2

Thread: Database Error

  1. #1
    Howdy Guest

    Default Database Error

    I&#039m trying to send a form to an Access database.But i keep getting the Error message "Microsoft JET Database Engine error &#039 80040e14&#039 <BR><BR>Syntax error in INSERT INTO statement. <BR><BR>/QS/new items.asp, line 36 "<BR><BR>I used response.write statement to make sure that the information are being transformed correctly from the form,and it&#039s working.<BR>Please help.This is the code i&#039m using<BR><BR>&#060;%<BR>&#039 Declaring variables<BR>Dim item,unit,price, data_source, con, sql_insert<BR><BR>&#039 A Function to check if some field entered by user is empty<BR>Function ChkString(string)<BR>If string = "" Then string = " "<BR>ChkString = Replace(string, "&#039", "&#039&#039")<BR>End Function<BR><BR>&#039 Receiving values from Form<BR>item = ChkString(Request.Form("item"))<BR>unit = ChkString(Request.Form("unit"))<BR>price = ChkString(Request.Form("price"))<BR><BR><BR><BR>da ta_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ <BR>Server.MapPath("Cost Database.mdb")<BR>sql_insert = "insert into items (Item,Unit,Unit Price) values (&#039" & _<BR>item & "&#039, &#039" & unit & "&#039, &#039" & price & "&#039)"<BR><BR>&#039 Creating Connection Object and opening the database<BR>Set con = Server.CreateObject("ADODB.Connection")<BR>con.Ope n data_source<BR>con.Execute sql_insert<BR>&#039 Done. Close the connection<BR>con.Close<BR>Set con = Nothing<BR><BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Database Error

    Are the UNIT and UNIT PRICE fields actually strings? Or are they numbers? If numeric, lose the single quotes surrounding them (that is only for string values).<BR><BR>Also, write the field UNIT PRICE as [UNIT PRICE].<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