Paging through recordset created from MS SQL View
am 31.12.2004 12:30:49 von twindscheffel
I have been used to paging through recordsets but until now have not
come across this problem.
When my sql select statement is based upon a SQL View it always
returns -1 pages and this prevents the 'next page' / 'previous page'
links from working.
Should it be possible to do this or does the paging have to be done
within the View/SProc itself?
Thanks
Tom
Re: Paging through recordset created from MS SQL View
am 31.12.2004 14:58:03 von reb01501
Tom wrote:
> I have been used to paging through recordsets but until now have not
> come across this problem.
>
> When my sql select statement is based upon a SQL View it always
> returns -1 pages and this prevents the 'next page' / 'previous page'
> links from working.
This is due to the cursor type you are using. See:
http://www.aspfaq.com/show.asp?id=2193
Even though the article discusses RecordCount, PageCount, etc. are subject
to the same limitations. You need a cursor type that supports bookmarks to
enable ADO to retrieve RecordCount and PageCount properties. The minimum
cursor type that supports bookmarks is Static (dynamic and keyset should be
avoided in ASP since the extra functionality provided by these types is
usually not needed in ASP - that extra functionality comes at a cost: extra
memory and slower performance). See
http://msdn.microsoft.com/library/en-us/ado270/htm/mdcstcurs ortypeenum.asp
for the enumeration of the various cursor types. Also, see
http://msdn.microsoft.com/library/en-us/ado270/htm/mdproreco rdcount.asp for
a further discussion of the effect of cursor type on the RecordCount
property. And
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthsupp orts.asp, to see
how to determine in your code whether or not the recordset you are using
supports the functionality you require.
>
> Should it be possible to do this or does the paging have to be done
> within the View/SProc itself?
>
That is a possibility that you should explore. See:
http://www.aspfaq.com/show.asp?id=2120
Ken Schaeffer's site also has some good information here,
http://www.adopenstatic.com/experiments/recordsetpaging.asp, but his site
appears to be down at the moment. Try later.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"