Never underestimate the power of context highlighting!

Which in this case didn't catch the fact that a CFML comment ( <!--- ) in
the middle of my stored procedure was terminated with an HTML comment... (
--> ) ... <sigh>... which was the source of the problem... How did I figure
this out? I ran this code:

<cftry>
        <cfoutput><!-- some content  --></cfoutput>
        <cfstoredproc procedure="tap_adLibUpdate" datasource="#request.tap.dsn#"
        username="#request.tap.dsnusr#" password="#request.tap.dsnpwd#">
                <cfprocparam type="in" dbvarname="LibraryID"            
value="#variables.PageID#"
        cfsqltype="cf_sql_integer">
                <cfprocparam type="in" dbvarname="Ident"                        
value="#Request.User.ID#"
cfsqltype="cf_sql_integer">
                <cfprocparam type="in" dbvarname="UpdatedDate"
value="#CreateODBCDate(Now())#" cfsqltype="cf_sql_timestamp">
                <!--- indicates the file name for a top level container -- file 
extension
may change although file name is consistent --->
                <cfprocparam type="In" dbvarname="PageFileName" 
value="#variables.tempfil
ename#" cfsqltype="cf_sql_varchar"              null="#yesnoformat(not
rspage.istoplevelcontainer)#">
                <!--- archive path indicates where restoring content is being restored
from -->
                <cfprocparam type="in" dbvarname="ArchivePath"  
value="#variables.archivepa
th#"    cfsqltype="cf_sql_varchar"              null="#yesnoformat(not
request.tap.archivecontent)#">
                <cfprocparam type="In" dbvarname="Scheduled"            value="0"
cfsqltype="cf_sql_bit">
                <cfprocparam type="in" dbvarname="restoreid"
value="#variables.restoreid#"   cfsqltype="cf_sql_integer"
null="#yesnoformat(not IsDate(attributes.RestoreFromDate))#">
                <cfprocparam type="In" dbvarname="UpdateError"
value="#variables.errormessage#"        cfsqltype="cf_sql_varchar">
                <cfprocresult name="rsupdate" resultset="1">
        </cfstoredproc>
        <cfcatch>
                <cfsavecontent variable="temp"><cfoutput>
                exec tap_adLibUpdate
                        @LibraryID = #variables.PageID#,
                        @Ident = #Request.User.ID#,
                        @UpdatedDate = #CreateODBCDate(Now())#,
                        @PageFileName = <cfif
rspage.istoplevelcontainer>'#variables.tempfilename#'<cfelse>null</cfif>,
                        @ArchivePath = <cfif
request.tap.archivecontent>'#variables.archivepath#'<cfelse>null</cfif>,
                        @Scheduled = 0  ,
                        @restoreid = <cfif
IsDate(attributes.restorefromdate)>#variables.restoreid#<cfelse>null</cfif>,
                        @UpdateError = '#variables.errormessage#'
                </cfoutput></cfsavecontent>
                <cfthrow message="#temp#">
        </cfcatch>
</cftry>

And got this error: The tag is not correctly positioned relative to other
tags in the template: tag CFTRY must have some content. This means that
there must be at least one tag, some text or even just whitespace characters
between the <cftry> and </cftry> markers. This may be caused by an
unterminated ColdFusion comment ...

What _should_ have happened is that the CFML parsing engine should never
have executed the stored procedure since the closing </cfstoredproc> tag was
technically commented out -- and thrown an error indicating that it couldn't
find the closing comment mark or the closing </cfstoredproc> tag. What
should have happened didn't, however...

In any event -- in case anyone else has a similar problem, there's what I
found. :)

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> **********************************************************
> ************
> WESTMINSTER CITY COUNCIL
> Please refer to the disclaimer beneath this message
> **********************************************************
> ************

> YOu can comment out the call to the stored procedure and
> then output all the
> variables you are passing, then use a CFABORT to stop the
> page this way
> you'll be sure the correct variables are being passed. Or
> for testing
> purposes hard-code a value in the LibraryID cfprocparam
> tag, if it does get
> passed in correctly then you will know that the problem is
> the stored
> procedure and not your CF.



> -----Original Message-----
> From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]]
> Sent: 30 September 2002 02:34
> To: CF-Talk
> Subject: more cfstoredproc issues ...


> Argh!

> I have a stored procedure with parameters as:

> CREATE   PROCEDURE tap_adLibUpdate
>       @LibraryID int,
>       @Ident int,
>       @UpdatedDate datetime,
>       @PageFileName varchar(15) = NULL,
>       @ArchivePath varchar(15) = NULL,
>       @Scheduled bit = 0,
>       @RestoreID int = NULL,
>       @UpdateError varchar(8000) = NULL
> AS

> and I'm using this code in CF:

> <cfstoredproc procedure="tap_adLibUpdate"
> datasource="#request.tap.dsn#"
> username="#request.tap.dsnusr#"
> password="#request.tap.dsnpwd#">
>       <cfprocparam type="in" dbvarname="LibraryID"
> value="#variables.PageID#"
> cfsqltype="cf_sql_integer">
>       <cfprocparam type="in" dbvarname="Ident"
>       value="#Request.User.ID#"
> cfsqltype="cf_sql_integer">
>       <cfprocparam type="in" dbvarname="UpdatedDate"
> value="#CreateODBCDate(Now())#"
> cfsqltype="cf_sql_timestamp">
>       <!--- indicates the file name for a top level container
>       -- file
> extension
> may change although file name is consistent --->
>       <cfprocparam type="In" dbvarname="PageFileName"
> value="#variables.tempfilename#"
> cfsqltype="cf_sql_varchar"
> null="#yesnoformat(not rspage.istoplevelcontainer)#">
>       <!--- archive path indicates where restoring content is
>       being
> restored from
> -->
>       <cfprocparam type="in" dbvarname="ArchivePath"
> value="#variables.archivepath#" cfsqltype="cf_sql_varchar"
> null="#yesnoformat(not request.tap.archivecontent)#">
>       <cfprocparam type="In" dbvarname="Scheduled" value="0"
> cfsqltype="cf_sql_bit">
>       <cfprocparam type="in" dbvarname="restoreid"
> value="#variables.restoreid#"
> cfsqltype="cf_sql_integer"
> null="#yesnoformat(IsDate(attributes.RestoreFromDate))#">
>       <cfprocparam type="In" dbvarname="UpdateError"
> value="#variables.errormessage#"
> cfsqltype="cf_sql_varchar">
>       <cfprocresult name="rsupdate" resultset="1">
> </cfstoredproc>

> and I'm getting this error:

> [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
> 'tap_adLibUpdate'
> expects parameter '@LibraryID', which was not supplied.

> I know that the LibraryID parameter is defined in the
> <cfprocparam> tags. I
> know that none of it was misspelled. I know that the value
> of
> variables.PageID is an integer. What I don't know is why
> I'm getting an
> error message that tells me exactly what the problem is
> not.

> Anybody have any ideas?

> Isaac Dealey
> Certified Advanced ColdFusion 5 Developer

> new epoch
> www.turnkey.to
> 954-776-0046


> __________________________________________________________
> ____________
> Your ad could be here. Monies from ads go to support these
> lists and provide more resources for the community.
> http://www.fusionauthority.com/ads.cfm
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> Archives:
> http://www.mail-archive.com/cf-talk@houseoffusion.com/
> Unsubscribe:
> http://www.houseoffusion.com/index.cfm?sidebar=lists



______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to