Getting error w/Paging through recordset
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/forms/Start3.asp, line 99
line 99 is objRs.AbsolutePage = ipage
Code:
<%
Dim objConn, objRS, strSQL
Dim pages, DisplayNum, i, page, ipage, z
Dim objRsPage
Dim RowCount
Dim PageCounter
Dim DateID, RoomID, strPeriod
'Get the Current page
page = request.querystring("page")
If page = "" Then
page = 1
else
page = cint(page)
End If
DisplayNum = 0
Sqlselected = Request.QueryString("Escalation_Type")
SqlStatus = Request.QueryString("Status")
set objConn=Server.CreateObject("ADODB.CONNECTION")
ObjConn.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"
Set objRS = Server.CreateObject("ADODB.Recordset")
Dim SqlStatus, Sqlselected
Sqlselected = Request("Escalation_Type")
If Len(Request.Form("Escalation_Type")) <> " " Then
SqlStatus = " AND Status = '" & request("Status") & "'"
Else
SqlStatus = " "
End If
Set ObjRS = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT TOP 7 * FROM Escalation_Forms WHERE Escalation_Type = '"& sqlselected & "'" & SqlStatus
objRS.Open strSql, objConn, 0, 1
' Set page size to 7
ObjRS.PageSize = 7
if objRS.eof then
Response.Write ("No records match your request!")
else
ipage = objRs.PageCount
if page = 0 or page > ipage Then
objRs.AbsolutePage = ipage
else
objRs.AbsolutePage = page
end if
'Response.Write(strSQL)
'Response.end
'Show records
%><b>
</b>
<p align="center">
<table border="2">
<tr>
<th bgcolor="#000000"><strong>Ticket Number</strong></th>
<th bgcolor="#000000"><strong>Escalation Type</strong></th>
<th bgcolor="#000000"><strong>First Name</strong></th>
<th bgcolor="#000000"><strong>Last Name</strong></th>
<th bgcolor="#000000"><strong>Account Number</strong></th>
<th bgcolor="#000000"><strong>Phone Number</strong></th>
<th bgcolor="#000000"><strong>CAE Name</strong></th>
<th bgcolor="#000000"><strong>Customer Comment</strong></th>
<th bgcolor="#000000"><strong>Status</strong></th>
<th bgcolor="#000000"><strong>Feed Back</strong></th>
</tr>
<%
Do Until ObjRS.EOF
'Loop through the records here
Response.Write ("<tr>")
Response.Write("<td><a href='Results.asp?TicketNum=" & objRS("Ticket_Number") & "'>" & objRS("Ticket_Number")& "</a></td>")
Response.Write "<td>" & objRS("Escalation_Type") &"</td>"
Response.Write "<td>" & objRS("First_Name") &"</td>"
Response.Write "<td>" & objRS("Last_Name") & "</td>"
Response.Write "<td>" & objRS("Account_Number") & "</td>"
Response.Write "<td>" & objRS("Phone_Number") & "</td>"
Response.Write "<td>" & objRS("Cae_Name") & "</td>"
Response.Write "<td>" & objRS("Cust_Com") & "</tr></td>"
Response.Write "<td>" & objRS("Status") & "</td>"
Response.Write "<td>" & objRS("Wip_Com") & "</td>"
ObjRS.MoveNext
Loop
%>
</table>
<%
'Add page navigation
If ipage > 1 Then
response.write "<p align=center>"
pages = "<b>Pages : "
For z = 1 to ipage
If z = page then
pages = pages & page & " "
Else
pages = pages & " <a href=?="&Escalation_Type&"&SqlStatus="&Status&"&pa ge=" & z & ">" & z & "</a>" & " "
End If
Next
response.write pages & " "
End If
if ipage > 1 And page > 1 Then
response.write "<a href=?Sqlselected="&Escalation_Type&"&SqlStatus="& Status&"&page="& page - 1 &">Previous</a>"
end if
response.write " "
If ipage > 1 And page < ipage Then
response.write "<a href=?Sqlselected="&Escalation_Type&"&SqlStatus="& Status&"&page="& page + 1 &">Next Page</a>"
end if
End if
'Close Data Access Objects and free DB variables
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>
|