p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: GetRows vs. Paging


Message #1 by "Alvin Ling" <alvin.ling@i...> on Tue, 28 Aug 2001 09:22:59 -0400
http://www.aspfree.com/devlinks/search.asp?file404=3Dgetrows;paging





At 09:22 AM 8/28/2001 -0400, you wrote:
>Is it possible to display "paged" results after using the GetRows method? 
 I
>tried the code below... (the stored procedure is just a select statement)
>but seems like my recordset object likes to change CursorTypes on the fly.
>
><%
>
>intPageSize =3D 10
>intPageCurrent =3D Request.QueryString("page")
>
>If Len(intPageCurrent) =3D 0 or not IsNumeric(intPageCurrent) Then
>         intPageCurrent =3D 1
>Else
>         intPageCurrent =3D CInt(intPageCurrent)
>End If
>
>Set objConn =3D Server.CreateObject("ADODB.Connection")
>objConn.Open strConn
>
>Set objCmd =3D Server.CreateObject("ADODB.Command")
>Set objRs =3D Server.CreateObject("ADODB.Recordset")
>
>With objRs
>         .PageSize =3D intPageSize
>         .CacheSize =3D intPageSize
>         .CursorType =3D adOpenStatic
>End With
>
>With objCmd
>         .ActiveConnection =3D objConn
>         .CommandText =3D "my_stored_proc"
>         .CommandType =3D adCmdStoredProc
>         ' *** Recordset CursorType is still adOpenStatic here
>         Set objRs =3D .Execute
>         ' *** Recordset has now changed CursorType back to
 adOpenForwardOnly
>End With
>
>Set objCmd =3D Nothing
>
>intPageCount =3D objRs.PageCount
>
>If intPageCurrent > intPageCount Then intPageCurrent =3D intPageCount
>If intPageCurrent < 1 Then intPageCurrent =3D 1
>
>If intPageCount =3D 0 Then
>         blnNoneFound =3D true
>Else
>         objRs.AbsolutePage =3D intPageCurrent    ' *** Code errors here
 since
>adOpenForwardOnly doesn't support bookmarks
>         objArr =3D objRs.GetRows()
>         intArrCount =3D UBound(objArr, 2)
>End If
>
>%>
>
>Thanks for any help anyone can provide.
>
>
>Alvin
>
>
>
>
>---
>* Fast, Full-Featured Microsoft=AE Excel Web Reports & Charts!
>A breakthrough in high performance Web application development,
 SoftArtisans
>ExcelWriter 1.1 supports native Excel charting, image insertion, and
>advanced functions & formatting. One click generates presentation-quality
>Excel spreadsheets-and ExcelWriter performs over 100 times faster than the
>Excel Object. Several editions, including ExcelWriterFREE, are available.
>http://www.softartisans.com/softartisans/excelwriter.html>
>


Robert Chartier
Author and Developer
xxx-xxx-xxxx
rob@a...
http://www.aspfree.com/devlinks
http://www.aspfree.com/authors/robert
http://www.aspalliance.com/nothingmn


  Return to Index