|
 |
asp_databases thread: paging: getting an error when trying to view next page
Message #1 by chris@d... on Tue, 19 Jun 2001 16:28:25
|
|
i have a form where i collect some data to query an access db. i post this
data to an asp page where i create a recordset and try to set up a paging
process. i get the first page of data but when i try to go forward to
another page i get an error. the error is below and then the code of my
two pages. thanks much for your help, i have been banging my head on this
for many DAYS.
**********************error***********************
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
/mspaging.asp, line 46
Browser Type:
Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
Page:
POST 20 bytes to /mspaging.asp
POST Data:
intpage=1&action=%3E
************************end error*******************
here's the code for the two asp pages:
the first page does connect to a db also to fill some dropdowns
*********************1st page form asp****************************
<html>
<head>
<title>Add Doc</title>
<%
dim oConn
set oConn=Server.CreateObject ("ADODB.connection")
oConn.open "DSN=webdocsbase"
%>
</head>
<body background="images/pvibg2.gif" link="#000000" vlink="#000000"
alink="#000000">
<table border="0" cellpadding="0" cellspacing="0" style="position:
absolute; left: 10; top: 85; width: 110; align="left" >
<tr>
<td valign="top">
<p align="center"><font face="Tahoma" size="2"><b><a
href="//seattle">home</a></font><p>
<hr>
<img border="0" src="images/wdsearch.gif" width="110" height="60">
<p align="center"><font face="Tahoma" size="2"><b><a
href="adddoc.asp">add<br>
</a><a href="/admin/te/index.asp">admin</a></b></font></p>
<hr>
<p> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" style="position:
absolute; left: 150; top: 85; width: 510; align="left">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="150" height="75"></td>
<td height="75"></td>
</tr>
<tr>
<td width="150"></td>
<td>
<form method="POST" action="mspaging.asp">
<INPUT TYPE=hidden NAME=Action VALUE=Search>
<table border="0" cellpadding="0" cellspacing="10" width="100%">
<tr>
<td colspan="2"><font face="Tahoma" size="2"
color="#000080"><b>Search for your documents.<br>Documents must have
previously been added to the WebDocs index.</b></font><p> </p></td>
</tr>
<tr>
<td width="150">Title</td>
<td><input type="text" name="doctitle" size="40"></td>
</tr>
<tr>
<td width="150">Type</td>
<%
dim oRStype
set oRStype=Server.CreateObject ("ADODB.recordset")
oRStype.open "type", oConn
%>
<td><select size="1" name="doctype">
<option selected value="doctype">All</option>
<%
Do While NOT oRStype.EOF
Response.Write "<OPTION VALUE='" & oRStype("type") & "'>"
Response.Write oRStype("type") & "</OPTION>"
oRStype.MoveNext
Loop
oRStype.Close
Set oRStype=nothing
%>
</select></td>
<tr>
<td width="150">Description</td>
<td><input type="text" name="description"
size="40"></textarea></td>
</tr>
<tr>
<td width="150">Frequency</td>
<%
dim oRSfreq
set oRSfreq=Server.CreateObject ("ADODB.recordset")
oRSfreq.open "frequency", oConn
%>
<td><select size="1" name="docfreq">
<option selected value="docfreq">All</option>
<%
Do While NOT oRSfreq.EOF
Response.Write "<OPTION VALUE='" & oRSfreq("frequency") & "'>"
Response.Write oRSfreq("frequency") & "</OPTION>"
oRSfreq.MoveNext
Loop
oRSfreq.Close
Set oRSfreq=nothing
%>
</select></td>
</tr>
<tr>
<td width="150">Department</td>
<%
dim oRSdept
set oRSdept=Server.CreateObject ("ADODB.recordset")
oRSdept.open "departments", oConn
%>
<td><select size="1" name="docdept">
<option selected value="docdept">All</option>
<%
Do While NOT oRSdept.EOF
Response.Write "<OPTION VALUE='" & oRSdept("department") & "'>"
Response.Write oRSdept("department") & "</OPTION>"
oRSdept.MoveNext
Loop
oRSdept.Close
Set oRSdept=nothing
%>
</select></td>
</tr>
<tr>
<td width="150">Category</td>
<%
dim oRScat
set oRScat=Server.CreateObject ("ADODB.recordset")
oRScat.open "categories", oConn
%>
<td><select size="1" name="doccat">
<option selected value="doccat">All</option>
<%
Do While NOT oRScat.EOF
Response.Write "<OPTION VALUE='" & oRScat("category") & "'>"
Response.Write oRScat("category") & "</OPTION>"
oRScat.MoveNext
Loop
oRScat.Close
Set oRScat=nothing
%>
</select></td>
</tr>
<tr>
<td width="150">Author</td>
<td><input type="text" name="docemp" size="30"></td>
</tr>
</table>
<p><input type="submit" value="Submit" ><input type="reset"
value="Reset" name="B2"></p>
</form>
<p> </td>
</tr>
</table>
<%
oConn.Close
Set oConn = Nothing
%>
</table>
</body>
</html>
******************end 1st page form asp****************************
********************2nd page paging asp****************************
<%@ EnableSessionState=False Language=VBScript %>
<%
Option Explicit
Dim sqlselect
If Request.Form("Action") = "Search" Then
sqlselect="SELECT * FROM doc WHERE number > 0"
If Request.Form("doctitle") <> "" Then
sqlselect = sqlselect & " AND doctitle Like '%" & Replace(Request.Form
("doctitle"),"'","''") & "%'"
End If
If Request.Form("doctype") <> "doctype" Then
sqlselect = sqlselect & " AND doctype = '" & Request.Form("doctype")
& "'"
End If
If Request.Form("description") <> "" Then
sqlselect = sqlselect & " AND description Like '%" & Replace
(Request.Form("description"),"'","''") & "%'"
End If
If Request.Form("docfreq") <> "docfreq" Then
sqlselect = sqlselect & " AND docfreq = '" & Request.Form("docfreq")
& "'"
End If
If Request.Form("docdept") <> "docdept" Then
sqlselect = sqlselect & " AND docdept = '" & Request.Form("docdept")
& "'"
End If
If Request.Form("doccat") <> "doccat" Then
sqlselect = sqlselect & " AND doccat = '" & Request.Form("doccat") & "'"
End If
If Request.Form("docemp") <> "" Then
sqlselect = sqlselect & " AND docemp Like '%" & Replace(Request.Form
("docemp"),"'","''") & "%'"
End If
End If
Dim conn
set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=webdocsbase"
Dim rs
set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3 ' adUseClient
' rs.Open "Select * from doc", conn
rs.Open sqlselect, conn
rs.PageSize = 2
Dim intPageCount
Dim intPage
Dim intRecord
intPageCount = rs.PageCount
Select Case Request("Action")
case "<<"
intpage = 1
case "<"
intpage = Request("intpage")-1
if intpage < 1 then intpage = 1
case ">"
intpage = Request("intpage")+1
if intpage > intPageCount then intpage = IntPageCount
Case ">>"
intpage = intPageCount
case else
intpage = 1
end select
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>ASP & ADO Paging</TITLE>
</HEAD>
<BODY bgColor=White text=Black>
<%
rs.AbsolutePage = intPage
Response.Write "<table style='position: absolute; left: 150; top: 85;
width: 510;'><tr><hr><tr>"
For intRecord = 1 To rs.PageSize
Response.Write "<tr>"
response.write "<tr><td width='100' valign='top'><font size='2'><a
style='color: #990033' href=" & rs("docpath") & "target=_blank>" & rs
("doctitle") & "</a></font></td>"
response.write"<td width='25' valign='top'><font size=1 color=#888888>" &
rs("docdept") & "</font></td>"
response.write"<td width='75' valign='top'><font size=1 color=#888888>" &
rs("docemp") & "</font></td>"
response.write "<td valign='top'><font size=2 color=#336699>" & rs
("description") & "<br> </font></td></tr>"
Response.Write "<tr>"
rs.MoveNext
If rs.EOF Then Exit For
Next
Response.Write "</table><p>"
rs.Close
set rs = Nothing
conn.Close
set conn = nothing
%>
<form name="MovePage" action="mspaging.asp" method="post">
<input type="hidden" name="intpage" value="<%=intpage%>">
<input type="submit" name="action" value="<<">
<input type="submit" name="action" value="<">
<input type="submit" name="action" value=">">
<input type="submit" name="action" value=">>">
Page: <%=Intpage & " of " & intpagecount%>
</form>
</BODY>
</HTML>
********************end 2nd page paging asp****************************
thanks much,
dohs
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 20 Jun 2001 10:44:45 +1000
|
|
www.adopenstatic.com/faq/800a0bb9.asp
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: <chris@d...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, June 19, 2001 4:28 PM
Subject: [asp_databases] paging: getting an error when trying to view next
page
: i have a form where i collect some data to query an access db. i post this
: data to an asp page where i create a recordset and try to set up a paging
: process. i get the first page of data but when i try to go forward to
: another page i get an error. the error is below and then the code of my
: two pages. thanks much for your help, i have been banging my head on this
: for many DAYS.
:
:
:
: **********************error***********************
:
: Error Type:
: ADODB.Recordset (0x800A0BB9)
: Arguments are of the wrong type, are out of acceptable range, or are in
: conflict with one another.
: /mspaging.asp, line 46
|
|
 |