sql - Trying to insert data into database after uploading image, syntax error in ASP Classic and VBscript -


After

I am trying to insert a record in the access database after uploading an image. Save image correctly but I can not get insert command to work.

  o = set new clsUpload if o.Exists ( "cmdSubmit") Then '(, o.FileNameOf ( "txtFile") "\") get path sFileSplit = partition client file name without sFile = sFileSplit (Ubound (sFileSplit)) o.FileInputName = "txtFile" o.FileFullPath = Server.MapPath ( "Ad") & Amp; "\" & Amp; SFile o.save if o.Error = "" respond to it. Write "success file saved" & amp; Opfile Path & amp; ". County =" & amp; o.ValueOf ( "County") company = o.ValueOf ( "Company") County = o.ValueOf ( "County") imgfile = sFile set OBJdbConnection = Server.CreateObject ( "ADODB.Connection") OBJdbConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0; data source = C: \ users \ user \ desktop \ Websites \ 123justlistit \ wwwroot \ admin \ 123justlistit.mdb "set sqlIns = Server.CreateObject (" ADODB.Command ") sqlIns.ActiveConnection = OBJdbConnection sqlIns.commandtext = sqlIns.Parameters.Append sqlIns.CreateParameter ( "@ company", AdVarChar, AdParamInput, putting in 25, the company) SqlInskParameters "ads (company, county, image) vALUES (?,?,?)". SqlIns.CreateParameter ("@ County", adVarChar, adParamInput, 25, County) Add sqlIns.Parameters.Append sqlIns.CreateParameter ("@ imgfile", adVarChar, adParamInput, 50, imgfile) sqlIns.execute OBJdbConnection.Close else response.write "Failed due to the following error:" & amp; o.Error If end and the other end if o = Nothing  

I set is to:

  Microsoft Jet Database Engine Error '80040e14' syntax error in the statement of INSERT  

I think there is something with the attempt to insert the file's file name, but I'm sure

two of your parameter names ( @company and < Code> @county ) conflict with columns name. To change the parameter name for either something different or better (better), put the identifier in your query string in the square bracket: [ad] ([company], [county] in the sqlIns.CommandText = " INSERT], [image])?,?,? Value () "

also avoids problems with identifying reserved words or with conflicting ones. Using square brackets


Comments