With CFMODULE it acts like a custom tag, so if you /> it, your actually calling it twice.
You need to do this <cfif thisTag.executionMode EQ "Start"> <cfstoredproc procedure="closeReq" datasource="webreg"> <cfprocparam type="in" cfsqltype="cf_sql_bigint" value="#attributes.tqd#"> <cfprocparam type="in" cfsqltype="cf_sql_char" value="#attributes.ActCode#"> </cfstoredproc> </cfif> That way it will only be called once and will only run once. Steve -----Original Message----- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stephen M Sent: Tuesday, 27 February 2007 1:29 PM To: cfaussie Subject: [cfaussie] cfstoredproc and cfprocparam I'm having some weird results with these two. I had put a cfstoredproc inside a separate file and i was calling it with a cfmodule, like this <cfmodule template="closerequest.cfm" reqid="#URL.tqd#" actcode="#URL.ActCode#"/> Then closerequest.cfm contained this <cfstoredproc procedure="closeReq" datasource="webreg"> <cfprocparam type="in" cfsqltype="cf_sql_bigint" value="#attributes.tqd#"> <cfprocparam type="in" cfsqltype="cf_sql_char" value="#attributes.ActCode#"> </cfstoredproc> The problem was that closeReq was being called twice. The first time it ran fine, but the second gave an error (as it should because the id was no longer valid) But if I replace the cfmodule with a direct call to the stored proc, then it runs just once (as it should) I'd rather call it from a separate file so that I can re-use the code for other purposes. Has anyone else experienced this problem with calling a template containing a cfstoredproc ? The second problem was with the cfprocparam. There are time when ActCode will be NULL, so I added the null="yes" attribute. But then it runs with NULL every time, even when ActCode isn't NULL. To get around it I had to use a test to check for the existence of ActCode, something like <cfif isDefined("ActCode")> <cfprocparam type="in" cfsqltype="cf_sql_char" value="#attributes.ActCode#"> <cfelse> <cfprocparam type="in" cfsqltype="cf_sql_char" value="#attributes.ActCode#" null="yes"> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---