Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 31st, 2004, 01:25 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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">

&nbsp;<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 : &nbsp;"
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 & "&nbsp;&nbsp;"
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 "&nbsp;&nbsp;"
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

%>





 
Old August 31st, 2004, 01:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Try CINT or CDBL the value before you pass it to the absolute page. Also write out the value to make sure it is a numerical value, on both clauses.

Brian
 
Old August 31st, 2004, 02:58 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi brian;

I got this example from the web and I tried to apply it into my application. I am still trying to disect the different parts and understand how it works. if it's not to much to ask can you show me how I can apply the answer you just give me.

Thank you

 
Old September 2nd, 2004, 06:41 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

CInt(ipage)

Check the usage of CINT function for more details.

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
DB recordset paging using ajax paging? kumiko Classic ASP Basics 0 May 26th, 2008 10:23 AM
asp searching and recordset paging kumiko Classic ASP Basics 0 May 22nd, 2007 03:46 AM
Recordset Paging incorrectly. Please help! phudong3da Dreamweaver (all versions) 4 October 4th, 2005 05:39 PM
Problem with recordset paging Stefania Classic ASP Databases 0 February 11th, 2005 08:59 AM
Problem in Recordset Paging zaeem Classic ASP Databases 2 October 15th, 2003 12:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.