There are few examples of using SQL variables inside a cfquery, but they do work. Below is an example showing an unfolded string. If you want to fold the query into a single string, like your code, that should work as well. (The Switch_box CF SQL Tool uses this technique for running stored procedures via the SQL Batch Wizard's interface. You can see more examples by using the tool.)
<cfquery ....
DECLARE @Name [varchar](50), @DateCreate [datetime]
SET @Name = '#Left(form.name,50)#' SET @DateCreate = '#form.date#'
INSERT INTO dbo.Contacts
(
[Name],
[DateCreate]
)
VALUES
(
@Name,
@DateCreate
)</cfquery>
/* Editorial. Type casting from CF to SQL can cause some hidden problem with database like number mis-representation. In CFMX it is very easy to make functions that can have unfolded string queries and use cfqueryparam for variable casting. Programs passing a folded string in single query function may be more code cool than type effective. Debugging a folded query function seems to be more difficult than debugging the unfolded query. An unfolded query function may be more efficient for insert queries where many columns require data input. Since CF uses pass-by-reference calls for function parameters that use data structures, calling the insert function and passing in a data structure of values means more application time can be spent building correct values than building query strings. */
Joseph
At 03:34 PM 9/21/2004, you wrote:
Well there are a couple of scoping issues in "query()" that may be causing an issue if you run this concurrently in a shared scope. You need "var" statements for the following variables: n, i, j, sCurrent, keylist, keylen.
As for continuing troubleshooting, I would recommend removing all of the fancy error handling after <cfcatch type="database"> and doing a simple <cfdump var="#cfcatch#"><cfabort> and trying it again. Make sure that that works before going any further.
Did you also check the cf exception and application logs (in \\CFusionMX\logs and \\CFusionMX\runtime\logs\default-err.log)?
Roland
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Sheridan Sent: Tuesday, September 21, 2004 4:45 PM To: [EMAIL PROTECTED] Subject: Re: [CFCDev] A Frustrating Function
A side note on this. it all works on 6.0.
Ian
On Tue, 21 Sep 2004 16:37:45 -0400, Ian Sheridan <[EMAIL PROTECTED]> wrote: > OK I will send a text file out. > > > > > On Tue, 21 Sep 2004 16:35:32 -0400, Roland Collins <[EMAIL PROTECTED]> wrote: > > Check the log files for errors as well, not just the screens. It would also > > be helpful if we could see the other functions that you have written that > > this one calls. > > > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > > Of Ian Sheridan > > Sent: Tuesday, September 21, 2004 4:28 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [CFCDev] A Frustrating Function > > > > that's my problem. I am not getting and error. the server spikes and I > > have to kill the cfserver. > > > > no error message... nothing. ugh! > > > > Ian > > > > On Tue, 21 Sep 2004 15:25:38 -0500, Raymond Camden <[EMAIL PROTECTED]> > > wrote: > > > I don't suppose you could share the error? > > > > > > > > =========================================================================== > > > Raymond Camden, Director of Development for Mindseye, Inc > > (www.mindseye.com) > > > Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) > > > > > > Email : [EMAIL PROTECTED] > > > Blog : www.camdenfamily.com/morpheus/blog > > > Yahoo IM : morpheus > > > > > > "My ally is the Force, and a powerful ally it is." - Yoda > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > > [mailto:[EMAIL PROTECTED] On Behalf Of Ian Sheridan > > > > Sent: Tuesday, September 21, 2004 3:24 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: [CFCDev] A Frustrating Function > > > > > > > > Alright, I need some help. I have a function that is crashing > > > > CF6.1 and I have absolutely no idea why. I have tested all > > > > the functions that are referred to within this code > > > > separately and they worked fine. > > > > This is a simple function logging a user's entry into the > > > > system. You will notice a query function I abstracted the > > > > cfquery tag so that I could use it in cfscript. > > > > > > > > > > > > > ---------------------------------------------------------- > > > You are subscribed to cfcdev. To unsubscribe, send an email > > > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > > > in the message of the email. > > > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported > > > by Mindtool, Corporation (www.mindtool.com). > > > > > > An archive of the CFCDev list is available at > > www.mail-archive.com/[EMAIL PROTECTED] > > > > > > > -- > > > > ---------------------- > > Ian Sheridan > > http://www.savagevines.com > > ---------------------- > > ---------------------------------------------------------- > > You are subscribed to cfcdev. To unsubscribe, send an email > > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > > in the message of the email. > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported > > by Mindtool, Corporation (www.mindtool.com). > > > > An archive of the CFCDev list is available at > > www.mail-archive.com/[EMAIL PROTECTED] > > > > > > ---------------------------------------------------------- > > > > > > You are subscribed to cfcdev. To unsubscribe, send an email > > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' > > in the message of the email. > > > > CFCDev is run by CFCZone (www.cfczone.org) and supported > > by Mindtool, Corporation (www.mindtool.com). > > > > An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED] > > > > > > > -- > > ---------------------- > Ian Sheridan > http://www.savagevines.com > ---------------------- >
--
---------------------- Ian Sheridan http://www.savagevines.com ----------------------
---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------------------- http://www.switch-box.org/CFSQLTool/Download/
Switch_box MediaFirm, Inc. www.Switch-box.org Loveland, CO USA
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
