S
stjulian
(IIS 6.0, SQL Server 2000)
I have a block of code that populates a recordset from a stored procedure.
The problem is, the recordset seems to be forward only (which would be OK),
but can't jump with the "AbsolutePage" property (which isn't OK)
How do I define the recordset that will allow this?
Julian
----------------------------------------------------------------------------------
Set adocmd = Server.CreateObject("ADODB.Command")
adocmd.CommandTimeout = 120
adocmd.ActiveConnection = conn
adocmd.CommandType = adCmdStoredProc
adocmd.CommandText = "dbo.spr_searchALL"
Set rsSearchM = Server.CreateObject ("ADODB.Recordset")
rsSearchM.ActiveConnection = conn
rsSearchM.CursorLocation = 3
' write to database using spr
With adocmd
set param = .CreateParameter("@criteria", adVarchar, adParamInput, 50,
"red" )
.parameters.append param
set param = .createparameter("@numrows", adInteger, adParamOutput)
.parameters.append param
On Error Resume Next
errorstring = ""
errornumber = 0
valid = 0
rsSearchM.open = .execute
'-- check the return value
If Err.Number <> 0 Then
errorstring = "<p>Error Number " & Err.Number & "<br>" & "The Error
Code was: " & Err.Description & "</p>"
errornumber = Err.Number
Response.Write(errorstring)
Response.Redirect(HomePath & "/error.asp?eid=unknown")
End If
.execute
numrowsM = .Parameters("@numrows").Value
End With
On Error GoTo 0
set adocmd = nothing
pagesize = 1000
rsSearchM.PageSize = pagesize
numpages = rsSearchM.PageCount
rsSearchM.MoveFirst
rsSearchM.AbsolutePage = currpage
----------------------------------------------------------------------------------
I have a block of code that populates a recordset from a stored procedure.
The problem is, the recordset seems to be forward only (which would be OK),
but can't jump with the "AbsolutePage" property (which isn't OK)
How do I define the recordset that will allow this?
Julian
----------------------------------------------------------------------------------
Set adocmd = Server.CreateObject("ADODB.Command")
adocmd.CommandTimeout = 120
adocmd.ActiveConnection = conn
adocmd.CommandType = adCmdStoredProc
adocmd.CommandText = "dbo.spr_searchALL"
Set rsSearchM = Server.CreateObject ("ADODB.Recordset")
rsSearchM.ActiveConnection = conn
rsSearchM.CursorLocation = 3
' write to database using spr
With adocmd
set param = .CreateParameter("@criteria", adVarchar, adParamInput, 50,
"red" )
.parameters.append param
set param = .createparameter("@numrows", adInteger, adParamOutput)
.parameters.append param
On Error Resume Next
errorstring = ""
errornumber = 0
valid = 0
rsSearchM.open = .execute
'-- check the return value
If Err.Number <> 0 Then
errorstring = "<p>Error Number " & Err.Number & "<br>" & "The Error
Code was: " & Err.Description & "</p>"
errornumber = Err.Number
Response.Write(errorstring)
Response.Redirect(HomePath & "/error.asp?eid=unknown")
End If
.execute
numrowsM = .Parameters("@numrows").Value
End With
On Error GoTo 0
set adocmd = nothing
pagesize = 1000
rsSearchM.PageSize = pagesize
numpages = rsSearchM.PageCount
rsSearchM.MoveFirst
rsSearchM.AbsolutePage = currpage
----------------------------------------------------------------------------------