Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error while paging thru recordset

Status
Not open for further replies.

rjkealey

Programmer
Feb 14, 2003
84
0
0
US
Hi All,
I keep getting error while paging thru recordset I just pasted this code from my other page and it worked fine there but will not work when I place code into html template or page layout I am using

***Error***

Error Type:
ADODB.Recordset (0x800A0BB9)
Unknown runtime error
/auto/proplist.asp, line 36


***line 36=****

RS.CursorLocation = adUseClient
RS.PageSize = Page_Size




***code****


<html>
<head>
<title>Untitled</title>
</head>

<body>


<%
Dim Connect_String
Dim Page_Size 'variable which holds the number of records to be viewed per page.
Dim Current_Page 'variable which keeps track of which page is the current page.


Dim SQL
Dim Page_Count 'variable which stores the number of pages that can be viewed.





Page_Size = 1 'here we set the number of records viewed per page to 1.

If Request(&quot;Page&quot;)=&quot;&quot; Then
Current_Page = 1
Else
Current_Page = CInt(Request(&quot;Page&quot;)) 'the CInt function converts the value to an integer.
End If

Set RS = Server.CreateObject(&quot;ADODB.RecordSet&quot;)



RS.CursorLocation = adUseClient
RS.PageSize = Page_Size

SQL = &quot;SELECT * FROM tblProperties&quot;

RS.Open SQL, MyConn, adOpenStatic, adLockReadOnly, adCmdText





Page_Count = RS.PageCount

If 1 > Current_Page Then Current_Page = 1
If Current_Page > Page_Count Then Current_Page = Page_Count

RS.AbsolutePage = Current_Page

Do While RS.AbsolutePage = Current_Page AND Not RS.EOF
%>


<form method=&quot;post&quot; action=&quot;db_register_user.asp&quot;>
<table width=&quot;400&quot; border=&quot;0&quot; align=&quot;center&quot;>
<tr align=&quot;center&quot;>
<td align=&quot;center&quot;>

<table align=&quot;right&quot; width=&quot;100&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;1&quot; frame=&quot;box&quot;>
<tr>
<td><a href=&quot;<%=RS.Fields(&quot;fldPicUrl&quot;)%>&quot; ><img height=&quot;100&quot; width=&quot;100&quot; border=&quot;0&quot;src=&quot;<%=RS.Fields(&quot;fldPicUrl&quot;)%>&quot;></a>
</td>
</tr>
</table>


</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Property Address :
<input type=text size=&quot;40&quot; name=&quot;price&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldAddress&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;left&quot;>
<td align=&quot;right&quot;>List Price :
<input type=text size=&quot;40&quot; name=&quot;price&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldPrice&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Folio :
<input type=text size=&quot;40&quot; name=&quot;Folio&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldFolio&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Legal Description :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldLegalDescription&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Taxes :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldTaxes&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Bed / Bath :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldBedBath&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Square Footage :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldSqrFootage&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Contact Info :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldContactInfo&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>LockBox Combo :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldLockBox&quot;).value) %>&quot;>

</td>
</tr>

<tr align=&quot;center&quot;>
<td align=&quot;right&quot;>Notes :
<input type=text size=&quot;40&quot; name=&quot;address&quot; value=&quot;<%=(Rs.Fields.Item(&quot;fldNotes&quot;).value) %>&quot;>

</td>
</tr>
</table>
</form>



<%
RS.MoveNext
Loop

'clean up
RS.Close
Set RS = Nothing
MyConn.Close
Set MyConn = Nothing

Response.Write &quot;<br>&quot;


'below is the page navigation.

If Current_Page <> 1 Then
Response.Write &quot;<a href=&quot;&quot;proplist.asp?Page=&quot;

Response.Write Current_Page - 1
Response.Write &quot;&quot;&quot;><div align=&quot;&quot;center&quot;&quot;><img src=&quot;&quot;prev_1.gif&quot;&quot; border=&quot;&quot;0&quot;&quot;></div></a>&quot; & vbCrLf
Response.Write &quot; &quot; & vbCrLf
End If
If Current_Page < Page_Count Then
Response.Write &quot;<a href=&quot;&quot;proplist.asp?Page=&quot;
Response.Write Current_Page + 1
Response.Write &quot;&quot;&quot;><div align=&quot;&quot;center&quot;&quot;><img src=&quot;&quot;next_1.gif&quot;&quot; border=&quot;&quot;0&quot;&quot;></div></a>&quot; & vbCrLf
End IF

%>



<center>Page <%=Current_Page%> of <%=Page_Count%></center>

</body>
</html>


Thanks all
RJKealey

 
I think you need to include adovbs.inc in order to use the ADO constants.
 
I already included in dbconnect.asp
RJKealey
 
Hi RJKealey,

I may be missing something, but if dbconnect.asp is a different page, the include there will not transfer over to this page. You will need to include it here as well.

I also have a question about your connection string MyConn (on your RS.Open statement) - where is that getting set? If it is getting set on another asp page, unless you are passing it via form values, query string or session (which doesn't appear to be the case here), it is unavailable to this page. You will need to set it on this page as well in order to use it.

Hope this helps,
Cathy
 
CathyW
I have incuded my dbconnect on all pages

***dbConnect.asp***
<%
dim ConnectionString
dim MyConn
dim RS


'set connection string to local variable-I use a DSN-less connection
ConnectionString = &quot;DRIVER=Microsoft Access Driver (*.mdb);DBQ=&quot; & Server.MapPath(&quot;foreclosure.mdb&quot;)

Set MyConn=Server.CreateObject(&quot;ADODB.Connection&quot;)
Set RS=Server.CreateObject(&quot;ADODB.RecordSet&quot;)




MyConn.Open ConnectionString
%>

then I just include this file in my page
such as
<!--#INCLUDE VIRTUAL=&quot;adovbs.inc&quot; -->
<!--#INCLUDE file=&quot;dbConnect.asp&quot; -->

thanks
RJKealey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top