Hi Stephen,

> 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 can also use a boolean test on the length to reduce this code, see
more here.

http://www.chapter31.com/2007/02/04/cfqueryparam-and-conditional-handling-of-nulls/

Michael

On Feb 26, 6:28 pm, "Stephen M" <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to