Stuart, did you get any satisfaction on this yet?
You didn't say which version of CF, but generally, it is asking for
trouble to include a function inside the cfqueryparam -- something to do
with how that value is bound to the DB server.
Try:
<cfloop index="i" from="1" to="#form.numberOfQuestions#">
<cfset idval = Val(InsertInterviewDetails.interviewID)>
<cfset quest = Trim(form['question' & i])>
<cfquery name="InsertQuestion" datasource="user020">
INSERT INTO tbl_020publicQuestions (interviewID, question)
<cfqueryparam cfsqltype="CF_SQL_INTEGER" null="No" value="#idval#" />,
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" null="No" value="#quest#" />
</cfquery>
</cfloop>
and see if that fixes it.
J
Stuart Kidd wrote:
>Thanks for that, but I appear to still be having a problem, perhaps it's
>because I've got a loop there?
>
> <!-- insert questions -->
> <cfloop index="i" from="1" to="#form.numberOfQuestions#">
> <cfquery name="InsertQuestion" datasource="user020">
> INSERT INTO tbl_020publicQuestions (interviewID, question)
> <cfqueryparam cfsqltype="CF_SQL_INTEGER" null="No"
>value="#Val(InsertInterviewDetails.interviewID)#" />,
> <cfqueryparam cfsqltype="CF_SQL_VARCHAR" null="No"
>value="#Trim(form['question' & i])#" />
> </cfquery>
> </cfloop>
>
>The error getting returned is:
>
> Error Executing Database Query.
> [Macromedia][SQLServer JDBC Driver][SQLServer]Line 2: Incorrect syntax near
>'@P1'.
>
>And the other bit coming up on the error page is:
>
> INSERT INTO tbl_020publicQuestions (interviewID, question) (param 1) ,
>(param 2)
>
>Thanks very much,
>
>Saturday
>
>
>On 24/4/05 8:04 pm, "Michael T. Tangorre" <[EMAIL PROTECTED]> wrote:
>
>
>
>>>From: Stuart Kidd [mailto:[EMAIL PROTECTED]
>>> INSERT INTO tbl_020publicQuestions (interviewID, question)
>>>VALUES (31, 'Oh, and i thought i'd written a lot but in fact
>>>i hadn't written anything at all is that really that bad or
>>>is that wrong?')
>>>319 : <cfquery name="InsertQuestion" datasource="user020">
>>>320 : INSERT INTO tbl_020publicQuestions
>>>(interviewID, question)
>>>321 : VALUES (#InsertInterviewDetails.interviewID#,
>>>'#Evaluate('form.question' & i)#')
>>>322 : </cfquery>
>>>323 : </cfloop>
>>>
>>>
>>Use cfqueryparam and ditch the evaluate. See below:
>>
>><cfquery name="InsertQuestion" datasource="user020">
>>INSERT INTO
>>tbl_020publicQuestions
>>(
>>interviewID,
>>question
>>)
>>VALUES
>>(
>><cfqueryparam cfsqltype="CF_SQL_INTEGER" null="No"
>>value="#Val(InsertInterviewDetails.interviewID)#" />,
>><cfqueryparam cfsqltype="CF_SQL_VARCHAR" null="No"
>>value="#Trim(form['question' & i])#" />
>>)
>></cfquery>
>>
>>HTH,
>>
>>Mike
>>
>>
>>
>>
>>
>>
>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205804
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54