Link to home
Start Free TrialLog in
Avatar of r_pat72
r_pat72

asked on

Trying to Implement paging in classic asp.ADODB.Recordset error '800a0cb3' ,Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.

Trying to Implement paging in classic asp.

Its gives me error that is below.

ADODB.Recordset error '800a0cb3' ,Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.

Here is my code.

Set rs= Server.CreateObject("ADODB.Recordset")
            
            
rs.CursorLocation = 3      'adUseClient
rs.CursorType = 3            'adOpenStatic

FormCmdObject "Sp_name"      '' FormCmdObject is a sub in my page which forms the command object                  
AddParameters cmd, "param1", advarchar, 10, m_val1 '' AddParameters is a sub which collects param
AddParameters cmd, "@param2", advarchar, 4000, val2
Set rs = cmd.Execute


            rs.PageSize = iPageSize
            rs.CacheSize = iPageSize


            iPageCount = rs.PageCount
            iFieldCount = rs.Fields.Count
            iRecordCount = rs.RecordCount

            If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
            If iPageCurrent < 1 Then iPageCurrent = 1

iRecordCount = iRecordCount - 1
iFieldCount  = iFieldCount - 1
LoopRecordCount = LoopRecordCount - 1

pageNum = Round(iRecordCount/iPageSize)
If pageNum < (iRecordCount/iPageSize) Then pageNum = pageNum + 1

If iPageCurrent = 1 Then      
      intPageNum =  pageNum
else      
      intPageNum =  iPageCurrent-1
end if

If iPageCurrent = pageNum Then      
      intPage = pageNum
else      
      intPage =  iPageCurrent+1
end if  

Please help.

Thanks.


Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

Try changing the cursor type to adOpenDynamic (Integer Value: 2) and see if that works.
Unfortunately the questioner is using the Command object's Execute method to create the recordset so they cannot change anything.  For performance reasons, the only output available from the Execute method is a firehose (forward-only/read-only) cursor.

What they can do is change the method of opening the recordset to use the Recordset's Open method and use the Command object as the Source.  In that case they can define the CursorType as well as all other Recordset properties.
ASKER CERTIFIED SOLUTION
Avatar of CyrexCore2k
CyrexCore2k
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial