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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Posting data to a database.

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I posted this question before, but I'm still having a problem with it. As you can see from the code snippet, Form.Level is numeric, and is defined in my Access database as a number(long integer). It was suggested that to post a numeric value, I do not need single quotes around the variable name. With or without, I get the same error as shown below.

Code:
Form.Level = <cfoutput>#Form.Level#</cfoutput><br>
<cfif IsNumeric(#Form.Level#)>
	<cfoutput>Form.Level is numeric.</cfoutput>
<cfelse>
	<cfoutput>Form.Level IS NOT numeric.</cfoutput>
</cfif>

<CFQUERY NAME=&quot;RecordResults&quot; DATASOURCE=&quot;Question&quot;>
	INSERT INTO ATable
	(
	Level
	)
	values
	(
	 #form.Level#
	)
</cfquery>

And this is the result:

Form.Level = 5
Form.Level is numeric.






--------------------------------------------------------------------------------

Error Occurred While Processing Request
Error Diagnostic Information
ODBC Error Code = 37000 (Syntax error or access violation)


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



The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (15:1) to (15:52) in the template file C:\INETPUB\

Date/Time: 01/31/01 11:02:24
Browser: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
Remote Address: 127.0.0.1
HTTP Referer:

I'm really going crazy over this one!X-)
 
I think &quot;level&quot; may be a SQL keyword. Try changing the column name to something else and see if it works. That's all I have to offer! :) Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top