My apologies... for locking reason's Barney's method is better: <cfquery ... name="searchresult"> ... </cfquery>
<cfset session.searchresult = searchresult /> Make sure, if you're not using CFMX, that the CFSET statement is locked using CFLOCK. -- Mosh Teitelbaum evoch, LLC Tel: (301) 942-5378 Fax: (301) 933-3651 Email: [EMAIL PROTECTED] WWW: http://www.evoch.com/ > -----Original Message----- > From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 19, 2003 2:48 PM > To: CF-Talk > Subject: RE: Large Recordset Display Problem > > > Couldn't be simpler... > > <CFQUERY NAME="SESSION.myQuery" .... > ^^^^^^^^ > > -- > Mosh Teitelbaum > evoch, LLC > Tel: (301) 942-5378 > Fax: (301) 933-3651 > Email: [EMAIL PROTECTED] > WWW: http://www.evoch.com/ > > > > -----Original Message----- > > From: admin [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, March 19, 2003 2:40 PM > > To: CF-Talk > > Subject: Re: Large Recordset Display Problem > > > > > > Thanks all of you for the great info - now the for the stupid > > question ! do > > I use cachedwithin to get the data stored as a session variable ? > > > > I guess the question really is how do I stick a query in to session vars > > > > tia > > > > Richard > > ----- Original Message ----- > > From: "Mosh Teitelbaum" <[EMAIL PROTECTED]> > > To: "CF-Talk" <[EMAIL PROTECTED]> > > Sent: Wednesday, March 19, 2003 11:11 AM > > Subject: RE: Large Recordset Display Problem > > > > > > > Richard: > > > > > > There are two steps involved in doing this, data retrieval and data > > display. > > > > > > On the retrieval side, as others have mentioned, you'd be well served > > > caching the results of the query. If the query is > > user-specific, cache it > > > in SESSION. If the query is not user-specific, you might try > > adding it to > > > ColdFusion's query cache. If the query is not user-centric > and will not > > > change over time, cache it in APPLICATION. > > > > > > On the display side, regardless of how it's cached, you can use the > > STARTROW > > > and MAXROWS attributes of the CFOUTPUT tag to make a > "prev/next n" style > > > display. Your code would look something like: > > > > > > <!--- Init MAXROWS and STARTROW ---> > > > <CFPARAM NAME="URL.StartRow" DEFAULT="1"> > > > <CFPARAM NAME="URL.MaxRows" DEFAULT="10"> > > > > > > <!--- Output up to MaxRows results starting from StartRow ---> > > > <CFOUTPUT QUERY="myQuery" MAXROWS="#URL.MaxRows#" > > > STARTROW="#URL.StartRow#"> > > > #myQuery.Col1# - #myQuery.Col2#<BR> > > > </CFOUTPUT> > > > > > > <!--- Display prev/next MaxRows links ---> > > > <CFIF myQuery.RecordCount NEQ 0> > > > <CFIF URL.StartRow GT URL.MaxRows> > > > <CFSET tmpStartRow = URL.StartRow - URL.MaxRows> > > > <A > > HREF="results.cfm?MaxRows=#URL.MaxRows#&StartRow=#tmpStartRow#">&##60; > > > Previous #URL.MaxRows# Results</A> | > > > </CFIF> > > > > > > <CFSET EndRow = URL.StartRow + URL.MaxRows - 1> > > > Results #URL.StartRow# - > > > <CFIF EndRow LT myQuery.RecordCount> > > > #EndRow# > > > <CFELSE> > > > #myQuery.RecordCount# > > > </CFIF> > > > > > > <CFIF EndRow LT myQuery.RecordCount> > > > <CFSET tmpStartRow = URL.StartRow + URL.MaxRows> > > > <CFIF EndRow + URL.MaxRows LTE myQuery.RecordCount> > > > <CFSET nextNum = URL.MaxRows> > > > <CFELSE> > > > <CFSET nextNum = myQuery.RecordCount - EndRow> > > > </CFIF> > > > | <A > > HREF="results.cfm?MaxRows=#URL.MaxRows#&StartRow=#tmpStartRow#">Next > > > #nextNum# Results &##62;</A> > > > </CFIF> > > > </CFIF> > > > > > > HTH > > > > > > -- > > > Mosh Teitelbaum > > > evoch, LLC > > > Tel: (301) 942-5378 > > > Fax: (301) 933-3651 > > > Email: [EMAIL PROTECTED] > > > WWW: http://www.evoch.com/ > > > > > > > > > > -----Original Message----- > > > > From: admin [mailto:[EMAIL PROTECTED] > > > > Sent: Wednesday, March 19, 2003 1:36 PM > > > > To: CF-Talk > > > > Subject: Large Recordset Display Problem > > > > > > > > > > > > I have a query that returns the results of a search. Potentially > > > > this could be a few hundred records. What I want to be able to do > > > > is execute the query once (as it's a slow query) but then only > > > > display a limited number of records per page (25 or so) and have > > > > some navigation to move thru the results, but with out re-doing > > > > the search. > > > > > > > > Any thoughts ? > > > > > > > > TIA > > > > > > > > Richard > > > > > > > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4