paging with ADODB.Command and Recordsets
I need help, I need to use paging or similar for a ADODB.Command that turns
into a recordset script...
I will explain more...
I need my page to have a list of 10 records displayed, at the top it will
say 1 - 10 of 26, then will show a list of records from a database 10 at
a time with next page and previous page links.
Below is my script to search the database, I would appreciate it if someone
could modify it for me to do this, or tell me how I could do it
<% Option Explicit
<!-- #Include File = "Connections/Datastore.asp"-->
<!-- MetaData Type = "TypeLib" File="C:\Program Files\Common Files\System\ado\msado15.dll"-->
Dim objCommand, objRS
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = strConnect
objCommand.CommandText = "SELECT * FROM AllData " &_
"WHERE Person LIKE '%" & Request.Form("Rept") & "%' "
objCommand.CommandType = adCmdText
Set objRS = objCommand.Execute
Set objCommand = Nothing
If objRS.EOF Then
Response.write "That is not available"
Response.write "<table border=1>"
Response.write "<tr><td>ID Number</td><td>Lister</td><td>Reptile</td>"
& "<td>Open File</td></tr>"
While Not objRS.EOF
Response.write "<tr><td>" & objRS("ID") & "</td><td>" & objRS("Listers")
& "</td><td>" & objRS("Reptile") & "</td><td>Open</td></tr>"
Set objRS = Nothing
Re: paging with ADODB.Command and Recordsets
I think that it's much better to create ADODB.Connection object
set oConn = Server.CreateObject("ADODB.Connection")
after that create rs like ADODB.Recordset object on same way
rs.ActiveConnection = oConn
rs.PageSize = 10
rs.CacheSize = 10
rs.CursorLocation = 3 (adUseClient) this line is most important here because
with this line you got all of records from database on local maschine and
than you can uce CountRecords property of recordset but before you must specify
rs.Source = "SELECT .... "
nNumberOfRecords = rs.RecordCount
nNumberOfPages = rs.PageCount
I hope that I'm help you
nNumberOfRecords = rs.CountRecord
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center