Thanx Tom and Taco for your help. Great, really!

By now works fine and I'll would show what I need to do:


In calling page:

<CFIF IsDefined('session.qryListNames')>
<!---DEFINED PROPERLY--->
<cfoutput query="session.qryListNames">
#CDUser#<br />
</cfoutput>
<CFELSE>
<!---NOT DEFINED - YET--->
<cfinvoke component="components.qryNames" method="getAllNames"
returnvariable="qryListNames"><<<<--------
</cfinvoke>

<cfset session.qryListNames = #qryListNames# ><<<<--------
</CFIF>

In CFC:

<cffunction name="getAllNames" output="true" access="public" returntype="query">
<cfargument name="CDUser" type="numeric" required="no"> 
<cfquery name="qryListNames" datasource="#application.DSN#">
 SELECT foo
from foo
</cfquery>
<cfreturn qryListNames> <<<<--------
</cffunction>

After invoking my component with returnvariable in the same name
inside CFC works fine.

Cheers

MD

2005/10/3, Taco Fleur <[EMAIL PROTECTED]>:
> Change the name and remove session.
> Then add a return statement
>
> <cfquery name="qryListNames" datasource="#application.DSN#">
>        SELECT
>        blablabla
> FROM
> </cfquery>
> <cfreturn qryListNames />
>
> </cffunction>
>
> If you want to set the query in the session scope you should do that after
> the call to the function, i.e.
>
> <cfset session.qryListNames  = obj.getAllNames() />
>
> Taco Fleur - Pacific Fox
> an industry leader with commercial IT experience since 1994 .
> http://www.pacificfox.com - Web Design and Development
>
>
>
> We endorse PayPal, accept payments online now!
>
>
> > -----Original Message-----
> > From: Michel Deloux [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, 4 October 2005 7:09 AM
> > To: CF-Talk
> > Subject: Invoking query and fails
> >
> >
> > Hi all
> >
> > we have a form with simple fields. If session.nameofquery is
> > not defined I invoke a cfc to get that data. Looks like:
> >
> > <CFIF IsDefined('session.qryMyQuery')>
> > <cfdump var="#session.qryMyQuery#">
> > <cfoutput query="#session.qryMyQuery#">
> > #ID_name"<br />
> > </cfoutput>
> >
> > <CFELSE>
> >
> > <cfinvoke component="qryCFC" method="getAllNames">
> > </cfinvoke>
> > <cfdump var="#session.qryMyQuery#">
> > </CFIF>
> >
> > This is my simple function:
> >
> > <cffunction name="getAllNames" output="true" access="public"
> > hint="Get all names" returntype="void">
> > <cfargument name="blablabla" type="numeric" required="no">
> > <cfquery name="session.qryListNames" datasource="#application.DSN#">
> >       SELECT
> >       blablabla
> > FROM
> > blablabla
> > </cffunction>
> >
> > OK, OK, the good CFC practices Manual don't uses session
> > inside components. Right. But using application scope don't
> > work... ;-(
> >
> > In the first call to CFC I invoke that cfc which output a
> > query. But after cfoutput CF throws an error:
> >
> > Complex object types cannot be converted to simple values.
> >
> > Why? That cfc returns a query right? Or I'me wrong?
> >
> > Cheers
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219985
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to