Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-01-2006, 01:43 AM   PM User | #1
dplr
New to the CF scene

 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
dplr is an unknown quantity at this point
Help with ODBC Error Code = 37000 (Syntax error or access violation)

I am VERY rusty at this. Any help would be greatly appreciated.
Deb

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 (20:3) to (20:47) in the template file c:\websites\wwprsd\cms\clubs\signup.cfm.

This is the code:

<body>
<!---Ensure proper format and instances of data--->

<CFPARAM Name="FORM.club" Default="None Entered">
<CFPARAM Name="FORM.studentid" Default="None Entered">
<CFPARAM Name="FORM.firstname" Default="None Entered">
<CFPARAM Name="FORM.lastname" Default="None Entered">
<CFPARAM Name="FORM.team" Default="None Entered">

<cflock name="InsertNewRecord" type="exclusive" timeout="30">
<cftransaction>
<cfquery name="Addrecord" datasource="CLUBS">
INSERT INTO #FORM.club#(studentid, firstname, lastname, team)
VALUES(#FORM.studentid#,'#FORM.firstname#','#FORM.lastname#','#FORM.team#')
</cfquery>
</cftransaction>
</cflock>

<!---Redirect back to complete page--->

<cfoutput>
<meta http-equiv="REFRESH" content="0;url="Complete.cfm">
</cfoutput>
</body>
dplr is offline   Reply With Quote
Old 09-13-2006, 06:12 PM   PM User | #2
cfxerious
New to the CF scene

 
Join Date: Jun 2006
Location: US
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
cfxerious is an unknown quantity at this point
i'd focus some attention on the dynamic table name issue. For example, you have <cfparam name="form.club" default="Not Entered">

My guess is based on form values dictates which table to insert into? With that, there needs to be a more failsafe method of determining which table needs to be in the INSERT statement based on passed form values.

Maybe something like the following:

Code:
<cfif IsDefined("form.club") AND form.club neq "" AND Len(form.club)>
  <!---- run your code here for the rest of the form values and insert.---->
  <!---- Maybe add a conditional that aids in the selection of the table for the insert statement to work with based on passed form values.----->
<cfelse>
<--- error message about the insert failing ---->
</cfif>

let me know if I can be of any additional assistance.
__________________
cold fusion programming and hosting.
cfxerious is offline   Reply With Quote
Old 02-18-2007, 10:09 PM   PM User | #3
cfmatt
New Coder

 
Join Date: Feb 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
cfmatt is an unknown quantity at this point
Can you post the form code as well please.
cfmatt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:43 PM.


Advertisement
Log in to turn off these ads.