Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Absolute page from component to asp

Status
Not open for further replies.

Ekstrom

Programmer
Feb 13, 2001
9
SE
Hi

With the code below I want to page thru the recordset (page by page). I create the disconnected recordset in COM and send the data back to ASP.
Do someone know why all records are returned each time instead of just one page?
Also, it works fine if I don't return it back to ASP and iterate it directly from the component!

Public Function AbsolutePageX(ByVal curpage As Integer, ByVal PageSize As Integer, ByVal getusers_ID As Integer) As ADODB.Recordset
Dim objContext As COMSVCSLib.ObjectContext
Dim objRS As ADODB.Recordset
Dim strSQL As String

On Error GoTo Error_Handler

' Get a reference to the context object
Set objContext = GetObjectContext()
Set objRS = New ADODB.Recordset

' Use client cursor to enable AbsolutePosition property.
objRS.CursorLocation = adUseClient

strSQL = "Select ..."
objRS.Open strSQL, sConnect, adOpenForwardOnly

objRS.PageSize = CInt(PageSize)
objRS.AbsolutePage = CInt(curpage)

Set AbsolutePageX = objRS ' Set the return value
Set objRS.ActiveConnection = Nothing

' Everything worked
If Not objContext Is Nothing Then objContext.SetComplete

Exit_Handler:

' Clean up
Set objRS = Nothing
Set objContext = Nothing
Exit Function

Error_Handler:
Resume Exit_Handler

End Function
_________________
ASP COde:
<%
Set objRS = objASPTrans.AbsolutePageX(1, 5, Cint(owner))

For intRecord = 1 to objRS.PageSize
...
Next
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top