Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could someone please help. I get th

Status
Not open for further replies.

dodgyone

Technical User
Jan 26, 2001
431
GB
Could someone please help. I get the following error:

Drivers error '80040e14'
Syntax error in INSERT INTO statement

I've looked at that line but cannot work it out...

Thanks,

Marcus

<%
view = request.querystring(&quot;view&quot;)

' set up database conection
' this connection does not require an ODBC reference
path = Trim(Server.MapPath(&quot;/fpdb&quot;))
conn_string = &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; + path + &quot;\user_notes.mdb&quot;
Set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
con.open conn_string

if view = &quot;upload&quot; then
if request.form(&quot;send&quot;) <> &quot;&quot; then
User_ID = request.form(&quot;User_ID&quot;)
Machine_ID = request.form(&quot;Machine_ID&quot;)
Software_Notes = request.form(&quot;Software_Notes&quot;)
Hardware_Notes = request.form(&quot;Hardware_Notes&quot;)
General = request.form(&quot;General&quot;)

'Replace &quot; and ' signs prior to SQL
User_ID=replace(User_ID,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;)
User_ID=replace(User_ID,&quot;'&quot;,&quot;''&quot;)

Machine_ID=replace(Machine_ID,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;)
Machine_ID=replace(Machine_ID,&quot;'&quot;,&quot;''&quot;)

Software_Notes=replace(Software_Notes,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;)
Software_Notes=replace(Software_Notes,&quot;'&quot;,&quot;''&quot;)
Software_Notes=replace(Software_Notes,chr(10),&quot;<p></p>&quot;)

Hardware_Notes=replace(Hardware_Notes,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;)
Hardware_Notes=replace(Hardware_Notes,&quot;'&quot;,&quot;''&quot;)
Hardware_Notes=replace(Hardware_Notes,chr(10),&quot;<p></p>&quot;)

General=replace(General,&quot;&quot;&quot;&quot;,&quot;&quot;&quot;&quot;&quot;&quot;)
General=replace(General,&quot;'&quot;,&quot;''&quot;)
General=replace(General,chr(10),&quot;<p></p>&quot;)

mySQL = &quot;INSERT INTO User_table (user_id, machine_id, software_notes, hardware_notes, general) VALUES ('&quot; & user_id & &quot;', '&quot; & machine_id & &quot;', '&quot; & software_notes & &quot;', '&quot; & hardware_notes & &quot;', '&quot; & general & &quot;');&quot;

con.Execute(mySQL)
end if
end if
%>
 
Don't end your SQL string in a semi-colon. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
I've omitted the ; from the end of the sql string but I still get the same error message... any ideas?

Cheers...

Marcus
 
If any of your fields are blank, normally the SQL will return an error. What I'd do is right BEFORE you execute your SQL string, response.write it out to the screen so you can see what it looks like with the data in it. If there are missing areas, that's your problem.

If that doesn't work, please post what your SQL string looks like with the data in it (just copy it from the response.write. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
This is what I get back... any ideas Harold?

Thanks for your efforts,

Marcus

INSERT INTO User_table (user_id, machine_id, software_notes, hardware_notes, general) VALUES ('id', 'idc', 'r', 'r', 'r')
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO statement.

/IDCNET Live/Help/Computer Support/User_Details/create.asp, line 42
 
dodgyone,
what's the datatype of the &quot;user_id&quot; field in the database?
 
my fields are...

User_ID = text
Machine_ID = text
Software_Notes = memo
Hardware_Notes = memo
General = memo

..and the text fields are set to allow zero length
 
Problem solved guys if anyone is interested...

The field name 'general' is used in Access for other purposes and the sql was confusing itself because of this. I changed that field name and all was rosey

Cheers everyone for getting me thinking about the problem

;o)
 
dodgyone,
that's exactly what I wanted to write to you. You could go and try to rename the field, but in SQL Server one could just use [field_name] in order to escape reserved words. I think it could be done the same way in Access.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top