PageSize HELP!!!! ta :)

Results 1 to 4 of 4

Thread: PageSize HELP!!!! ta :)

  1. #1
    Shaz Guest

    Default PageSize HELP!!!! ta :)

    Right...I copied the Pagesize stuff from one of the articles and modded it a bit but it refuses to work, keeps saying:<BR><BR>ADODB.Recordset error &#039 800a0cb3&#039<BR>Operation is not supported for this type of object.<BR>/test.asp, line 46<BR><BR>Ta<BR><BR>****************************** **********************<BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;!--#include virtual="ADOVBS.inc"--&#062;<BR>&#060;%<BR> &#039Set how many records per page we want<BR> Const NumPerPage = 20<BR><BR> &#039Retrieve what page we&#039re currently on<BR> Dim CurPage<BR> If Request.QueryString("CurPage") = "" then<BR> CurPage = 1 &#039We&#039re on the first page<BR> Else<BR> CurPage = Request.QueryString("CurPage")<BR> End If<BR><BR> Dim conn<BR> Dim rs<BR> Dim DSN<BR><BR> set conn=server.createobject("adodb.connection")<BR>se t rs=server.createobject("adodb.recordset")<BR>&#039 dsnless connect to DB &#039<BR>DSN="DRIVER={Microsoft Access Driver (*.mdb)}; "<BR>DSN=dsn & "DBQ=" & server.mappath("/_news/news.mdb")<BR>conn.Open DSN<BR><BR> &#039Set the cursor location property<BR> rs.CursorLocation = adUseClient<BR><BR> &#039Set the cache size = to the # of records/page<BR> rs.CacheSize = 20<BR><BR> &#039Open our recordset<BR> Dim SQL<BR> SQL = "SELECT *FROM News"<BR> rs.Open SQL,Conn<BR><BR> rs.MoveFirst<BR> rs.PageSize = NumPerPage<BR><BR> &#039Get the max number of pages<BR> Dim TotalPages<BR> TotalPages = rs.PageCount<BR><BR> &#039Set the absolute page<BR> rs.AbsolutePage = CurPage<BR> <BR> &#039Counting variable for our recordset<BR> Dim count<BR>%&#062;<BR><BR>&#060;HTML&#062;<BR>&#060; BODY&#062;<BR>&#060;B&#062;Name - News&#060;/B&#062;<BR><BR>&#060;%<BR> &#039Set Count equal to zero<BR> Count = 0<BR> Do While Not rs.EOF And Count &#060; rs.PageSize<BR> Response.Write(rs("Name") & " - " & rs("News") & "<BR>")<BR> Count = Count + 1<BR> rs.MoveNext<BR> Loop<BR><BR> &#039Print out the current page # / total pages<BR> Response.Write("Page " & CurPage & " of " & TotalPages & "&#060;P&#062;")<BR><BR> &#039Display Next / Prev buttons<BR> if CurPage &#062; 1 then<BR> &#039We are not at the beginning, show the prev button<BR> Response.Write("&#060;INPUT TYPE=BUTTON VALUE=PREV ONCLICK=""document.location.href=&#039test.asp?cur page=" & curpage - 1 & "&#039;""&#062;")<BR> End If<BR><BR>if CInt(CurPage) &#060;&#062; CInt(TotalPages) then<BR> &#039We are not at the end, show a next button<BR> Response.Write("&#060;INPUT TYPE=BUTTON VALUE=NEXT ONCLICK=""document.location.href=&#039test.asp?cur page=" & curpage + 1 & "&#039;""&#062;")<BR> End If<BR><BR>%&#062;<BR><BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: PageSize HELP!!!! ta :)

    You need to open the recordset with a cursor that supports PageCount, PageSize, and AbsolutePage. adOpenStatic, adOpenDynamic, and adOpenKeyset all allow for such methods.<BR><BR>So, rather than doing:<BR>rs.Open SQL,Conn<BR><BR>do:<BR>rs.Open SQL, Conn, adOpenStatic<BR>

  3. #3
    Shaz Guest

    Default RE: PageSize HELP!!!! ta :)

    Still says line 46 thingy :(<BR><BR>Line 46 is rs.AbsolutePage = CurPage<BR><BR>*******************************<BR> <BR>ADODB.Recordset error &#039 800a0cb3&#039 <BR><BR>Operation is not supported for this type of object. <BR><BR>/test.asp, line 46 <BR>

  4. #4
    Ibrahim hamouda Guest

    Default RE: PageSize HELP!!!! ta :)

    It took me two days and 17 KB Articles to figure it out.<BR>the server cursor DOESNOT support PageSize and Absolut Stuff.<BR><BR>So<BR><BR>RS.CursorLocation=adUseCli ent<BR>RS.Open SQL,Conn,adOpenStatic,adLockOptimistic<BR><BR>that should work.<BR>You have to specify that the cursor is a client one.<BR><BR>hope this help<BR>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •