Beware using this approach if you plan on having a lot of possible results from a large table (millions of potential matches). We got bitten because the SQL became very expensive to run even with good indexes (well, I hope they were good). Works fine on small result sets though.
We ended up moving to an approach that didn't define the number of pages but instead always selected one more result than we needed and only exposed the "next" button if there was a full result set. Doesn't help with your problem but I thought it worth mentioning. Symon Rottem http://blog.symbiotic-development.com On Mon, Dec 22, 2008 at 11:01 PM, MAMMON <[email protected]> wrote: > > I also need to figure out a good paging solution. I have a stored > procedure that gives me my search results, and I could probably add > @pageNum and @pageSize parameters to it easily enough, but how would > you go about returning the TOTAL number of rows from the query? I > know that in the SQL, I'd probably have to do 2 queries; one to return > the actual records WITH paging restrictions, and one to return the > count of ALL records that matched the query, WITHOUT paging > restrictions. These could potentially be 2 different stored > procedures, or maybe just 1 that returns 2 data sets. Can NH handle > SPs that return multiple result sets? My SP is currently mapped with > a <sql-query> attributes, and the results are loaded to an entity > type, so I'm not sure how all that would work when it comes to getting > the count of results. > > On Dec 18, 5:45 am, "Fabio Maulo" <[email protected]> wrote: > > Which should be be the solution to make a StoredProcedure a > DynamicPaginable > > SQL ?Perhaps what you are needing is only add two parameters to your SP > and > > set values, of parameters, as you are doing for the others parameters. > > > > 2008/12/17 Renso <[email protected]> > > > > > > > > > My situation requires me to construct a complex sql query for a > > > generic search feature. I created a stored procedure for this. > > > However, seems the dynamic paging support with NH ver 2.0 is still > > > missing. Has anyone had similar issues and possible solutions? I did > > > not want to go through the trouble of creating a temp table in the > > > stored procedure to support paging unless there is an easier way, > > > perhaps a newer version of NH supports it? > > > > -- > > Fabio Maulo > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
