database paging

Results 1 to 2 of 2

Thread: database paging

  1. #1
    Join Date
    Dec 1969

    Default database paging

    I am working from someone else&#039;s code I got from ASP101. When I try to set my recordset object&#039;s AbsolutePage, the value is always returning a negative 1.<BR><BR>&#060;% option Explicit %&#062;<BR>&#060;!-- #include file="../connection.asp" --&#062;<BR>&#060;!-- #include file="../LogFile.asp" --&#062;<BR><BR><BR>&#060;%<BR><BR>dim sql &#039; string to hold sql statement<BR>dim rs &#039; recordset object<BR>Const PAGE_SIZE = 5 &#039; The size of our pages.<BR>Dim iPageCurrent &#039; The page we&#039;re currently on<BR>Dim iPageCount &#039; Number of pages of records<BR>Dim iRecordCount &#039; Count of the records returned<BR>Dim I &#039; Standard looping variable<BR>Dim strURL &#039; The URL of this page so the form will work<BR> &#039; no matter what this file is named.<BR><BR><BR><BR>&#039; Retrieve page to show or default to the first<BR>If Request.QueryString("page") = "" Then<BR> iPageCurrent = 1<BR>Else<BR> iPageCurrent = CInt(Request.QueryString("page"))<BR>End If<BR><BR><BR>strURL = Request.ServerVariables("URL")<BR><BR>sql = "SELECT LastName, FirstName, Status, LKA FROM TblMWData WHERE TblMWData.Status=&#039;" & Request.QueryString("status") & "&#039; ORDER BY LastName, FirstName"<BR><BR>&#039;Response.write(sql)<BR>&#0 39;response.end<BR><BR><BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR><BR>rs.P ageSize = PAGE_SIZE<BR>rs.CacheSize = PAGE_SIZE<BR><BR><BR>rs.Open sql, objConn, adOpenStatic, adLockReadOnly, adCmdText <BR><BR>If err.number &#060;&#062; 0 Then<BR> Call WriteToLog(err, sql, "newInmate.asp")<BR> Call CloseLog()<BR> err.number = 0<BR> Call ErrorPage()<BR> Response.end<BR>End If<BR><BR>iRecordCount = rs.RecordCount<BR>iPageCount = rs.PageCount<BR><BR>rs.AbsolutePage = iPageCurrent<BR><BR>Response.write("URL " & strURL & "<BR>")<BR>Response.write("Page Size " & rs.PageSize & "<BR>")<BR>Response.write("Record Count " & iRecordCount & "<BR>")<BR>Response.write("Page Count " & iPageCount & "<BR>")<BR>Response.write("Page current " & iPageCurrent & "<BR>")<BR>Response.write("Absolute Page " & rs.AbsolutePage & "<BR>")<BR>Response.end<BR>%&#062;<BR>

  2. #2
    Join Date
    Dec 1969

    Default Where is adOpenStatic defined?

    But see the ASPFAQs (link it center above) and the category "Databases, Errors" to see why you need a valid value for adOpenStatic.<BR><BR>HOWEVER...<BR><BR>Depending on what DB you are using, even that may not be enough.<BR><BR>You *MIGHT* try, just before the <BR> RS.Open<BR>call, doing<BR> RS.CursorLocation = adUseClient<BR><BR>No guarantees.<BR><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