(DB)Recordset Paging in ASP

They have: 2 posts

Joined: Jan 2002

Ok I tried some paging scripts around but they donesn´t worked, so here´s my recordset script, Can someone help me to divide the results in pages? you can watch this working at
http://user1.7host.com/sinsclan/reps/replays.asp
I would really appreciate it.
ok Here it is:

<?php
Option Explicit
?>

<?php
  dim Conn
, RS, ID
  Set Conn
= GetConnection
  Response
.Buffer=True
 
if "" & Request.QueryString("ID") <> "" and isnumeric(Request.QueryString("ID")) then
   
'If there is an ID in QUERY_STRING
    '
Write file from db to the client
    ID
= Clng(Request.QueryString("ID"))

    if
ucase(Request.QueryString("A"))="D" then'Delete
      Conn.execute("delete from Upload where UploadID=" & ID)
    Else'
Download
     
'file record
      Set RS = Conn.execute("select * from Upload where UploadID=" & ID)
      if ucase(Request.QueryString("A"))<>"P" then
        response.contenttype = RS("ContentType")'
set Content-Type
        Response
.AddHeader "Content-Disposition", "attachment;filename=""" & RS("SouceFileName") & """"
     
End If
   
'      Response.BinaryWrite RS("Data").Value 'Write the file from db field to the client
      Response
.BinaryWrite RS("Data").GetChunk(RS("DataSize")) 'Write the file from db field to the client
   
      RS.Close
      Conn.Close
      Response.End
    End If'
Download
  End
If

 
response.write Head("7-Replays", "Replay Database")
 
response.write DBList(Conn)
 
Conn.Close

function DBList(Conn)
 
dim HTML, RS, ContentType
   
'Open recordset with the files
    Set RS = Conn.execute("select UploadID, SouceFileName, Ganador, Razag, Perdedor, Razap, Mapa, ContentType from Upload order by UploadDT desc")
    HTML = HTML & "<Table><tr><th ColSpan=3><font face=Arial color=silver size=3>Replays : </font></th></tr>" & vbcrlf
    HTML = HTML & "<Table><tr><th ColSpan=2><font face=Arial color=silver size=1>Sube tus Replays <a href=http://user1.7host.com/sinsclan/reps/repupload.asp>;aqui</a></font></th></tr>" & vbcrlf
    HTML = HTML & "<tr><th bgcolor=gray><strong><font face=Arial color=silver size=2>D/l</font></strong></th><th bgcolor=gray><strong><font face=Arial color=silver size=2>Ganador</font></strong></th><th bgcolor=gray><strong><font face=Arial color=silver size=2>Perdedor</font></strong></th><th bgcolor=gray><strong><font face=Arial color=silver size=2>Mapa</font></strong></th></tr>" & vbcrlf
    do while not RS.Eof
      ContentType = lcase("" & RS("ContentType"))
      HTML = HTML & "<tr><td> <A HREF=" & Request.ServerVariables("SCRIPT_NAME") & "?ID=" & RS("UploadID")
      if left(ContentType,6)="image/" or left(ContentType,5)="text/"  then
        HTML = HTML & " onmouseover=""ShowFile('" & RS("
UploadID") & "')"" onmouseout=""HideFile()"""
      end if
      HTML = HTML & "><img border=0 src=dl.gif>" & "</A>"
      HTML = HTML & " </td><td><strong><font face=Arial size=2>" & RS("Ganador") & "</font></strong><font size=1 color=gray>" & RS("Razag") & "</font></td><td><strong><font face=Arial size=2>" & RS("Perdedor") & "</font></strong><font size=1 color=gray>" & RS("Razap") & "</font>"
      HTML = HTML & " </td><td><font face=Arial size=2>" & RS("Mapa") & "</font></td></tr>" & vbcrlf
      RS.MoveNext
    loop
    HTML = HTML & "</Table>" & vbcrlf
    DBList = HTML
  RS.Close
end function

function GetConnection()
  dim Conn, AuthConnectionString
AuthConnectionString = "DBQ=" & Server.MapPath("upload.mdb") & ";DefaultDir=" & Server.MapPath("/") & ";" & _
'      "Driver={Microsoft Access Driver (*.mdb)}; DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5;UID=;"
  AuthConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("upload.mdb")
  Set Conn = Server.CreateObject("ADODB.Connection")
  Conn.open AuthConnectionString
    set GetConnection = Conn
end function
?>

</script>

They have: 2 posts

Joined: Jan 2002

any help?

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Check out this example: http://www.asp101.com/samples/viewasp.asp?file=db%5Fpaging%2Easp

It should be easy to adapt to your query.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.