ADO.RecordCount equals - 1 problem

ado, asp-classic

Solution

For paging you can use the `recordset.PageSize` and `recordset.AbsolutePage` like this

Set rs = Server.CreateObject("ADODB.Recordset")
' make recordset use adUSEclient ( client side cursor)'
rs.CursorLocation = 3
' make recordset use the adOpenStatic cursor ( scrollable )'
rs.CursorType = 3
rs.PageSize = RecordsPerPage

rs.Open sql, conn
' go to selected page'
if not rs.EOF and not rs.BOF then
    rs.AbsolutePage = page_you_want_to_go
end if

you then have access to `recordset.PageCount` to know the number of pages returned..

Problem

When ever I try to access the RecordCount property, I always get a return value of -1. Below is my sample code. ``` Set oConn = Server.CreateObject ("ADODB.Connection") oConn.Open Application("strConnectstring") Set rs = Server.CreateObject ("ADODB.Recordset") rs.ActiveConnection = oConn SQL = "Publications_PicoSearchListing" set rs = oConn.execute(SQL) ``` I'm not sure if I'm doing forwardCursor or dynamic cursors, or if the provider even supports the RecordCount property. How do I check if the provider supports RecordCount property or if I'm using either forwardCursor or dynamic cursors. Any help would be appreciated. Thank You

Original source