Forums
This topic is locked
display 1 -10 recordset - asp
Posted 25 Mar 2003 18:06:17
1
has voted
25 Mar 2003 18:06:17 Aodhan Flynn posted:
Hi thereI am using dreamweaver to out put 1-10 of a recordset but i keep getting an error on the "recordount"line
Please help me thanks
Replies
Replied 26 Mar 2003 16:47:22
26 Mar 2003 16:47:22 Vince Baker replied:
If you post the code I will take a look at it for you....
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
Regards
Vince
Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 26 Mar 2003 16:58:08
26 Mar 2003 16:58:08 Aodhan Flynn replied:
Thanks Vince, this is the entire code
<%@LANGUAGE="VBSCRIPT"%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim RSlist_total
Dim RSlist_first
Dim RSlist_last
' set the record count
RSlist_total = RSlist.RecordCount
' set the number of rows displayed on this page
If (RSlist_numRows < 0) Then
RSlist_numRows = RSlist_total
Elseif (RSlist_numRows = 0) Then
RSlist_numRows = 1
End If
' set the first and last displayed record
RSlist_first = 1
RSlist_last = RSlist_first + RSlist_numRows - 1
' if we have the correct record count, check the other stats
If (RSlist_total <> -1) Then
If (RSlist_first > RSlist_total) Then
RSlist_first = RSlist_total
End If
If (RSlist_last > RSlist_total) Then
RSlist_last = RSlist_total
End If
If (RSlist_numRows > RSlist_total) Then
RSlist_numRows = RSlist_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (RSlist_total = -1) Then
' count the total records by iterating through the recordset
RSlist_total=0
While (Not RSlist.EOF)
RSlist_total = RSlist_total + 1
RSlist.MoveNext
Wend
' reset the cursor to the beginning
If (RSlist.CursorType > 0) Then
RSlist.MoveFirst
Else
RSlist.Requery
End If
' set the number of rows displayed on this page
If (RSlist_numRows < 0 Or RSlist_numRows > RSlist_total) Then
RSlist_numRows = RSlist_total
End If
' set the first and last displayed record
RSlist_first = 1
RSlist_last = RSlist_first + RSlist_numRows - 1
If (RSlist_first > RSlist_total) Then
RSlist_first = RSlist_total
End If
If (RSlist_last > RSlist_total) Then
RSlist_last = RSlist_total
End If
End If
%>
<html>
<body bgcolor="#ccffcc">
<%
Request.Form("map"
Request.Form("region"
Request.Form("map"
Request.Form("county"
'Request.Form("manager_name"
'Request.Form("business_type"
Response.Write(Request.Form("county"
)
Response.Write(Request.Form("manager_name"
)
Response.Write(Request.Form("business_type"
)
if Request.Form("region"
= "shannon" then Response.Write("not coming through"
End IF
if Request("county"
= "" then Response.Write("there is something worng here"
End IF
Query ="SELECT * FROM companys WHERE county LIKE '%" & Request("county"
& "%' AND manager_name LIKE '%" & Request("manager_name"
& "%'OR business_type LIKE '%" & Request("business_type"
& "%'"
Set DataConn = Server.CreateObject("ADODB.Connection"
DataConn.Open "dbireland"
Set RSlist = Server.CreateObject("ADODB.recordset"
RSlist.Open Query,DataConn,1,2
%>
<table >
<tr><td><b>Results</b></td></tr>
<%Do While Not RSlist.EOF%>
<tr><td><strong>Company Name</strong></td><td><%=RSlist("company_name"
%></td></tr>
<tr><td><strong>Manager Name</strong></td><td><%=RSlist("manager_name"
%></td></tr>
<tr><td><strong>Contact Name</strong></td><td><%=RSlist("contact_name"
%></td></tr>
<tr><td><strong>Email</strong></td><td><a href="mailto:<%=RSlist("email"
%>?Subject=Query through PromoteIreland.com"><%=RSlist("email"
%></a></td></tr>
<tr><td><strong>Website</strong></td><td><a href="http:\\<%=RSlist("url"
%>"><%=RSlist("url"
%></a></td></tr>
<tr><td><strong>Phone</strong></td><td><%=RSlist("phone_one"
%></td></tr>
<tr><td><strong>Alternative phone</strong></td><td><%=RSlist("phone_two"
%></td></tr>
<tr><td><strong>Address</strong></td><td><%=RSlist("address_one"
%></td></tr>
<tr><td> </td><td><%=RSlist("address_two"
%></td></tr>
<tr><td> </td><td>Co. <%=RSlist("county"
%></td></tr>
<tr><td><strong>Region</strong></td><td><%=RSlist("region"
%></td></tr>
<tr><td><strong>Business Type</strong></td><td><%=RSlist("business_type"
%></td></tr>
<% If RSlist("MeetingDocs_Name"
= "" then %><tr><td>There is no image available for this company</td></tr><%else%><tr><td><strong>Image</strong></td><td><IMG SRC="\\Eceittweb\USERS\2002\9921214\fyp\uploaded_images\<%=RSlist("email"
%>\<%=Rslist("MeetingDocs_Name"
%>" ></td></tr> <%End If%>
<%RSlist.Movenext
Loop%>
<tr>
<td> Records <%=(RSlist_first)%> to <%=(RSlist_last)%> of <%=(RSlist_total)%> </td>
</tr>
</table>
</body>
</html>
<%@LANGUAGE="VBSCRIPT"%>
<%
' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
Dim RSlist_total
Dim RSlist_first
Dim RSlist_last
' set the record count
RSlist_total = RSlist.RecordCount
' set the number of rows displayed on this page
If (RSlist_numRows < 0) Then
RSlist_numRows = RSlist_total
Elseif (RSlist_numRows = 0) Then
RSlist_numRows = 1
End If
' set the first and last displayed record
RSlist_first = 1
RSlist_last = RSlist_first + RSlist_numRows - 1
' if we have the correct record count, check the other stats
If (RSlist_total <> -1) Then
If (RSlist_first > RSlist_total) Then
RSlist_first = RSlist_total
End If
If (RSlist_last > RSlist_total) Then
RSlist_last = RSlist_total
End If
If (RSlist_numRows > RSlist_total) Then
RSlist_numRows = RSlist_total
End If
End If
%>
<%
' *** Recordset Stats: if we don't know the record count, manually count them
If (RSlist_total = -1) Then
' count the total records by iterating through the recordset
RSlist_total=0
While (Not RSlist.EOF)
RSlist_total = RSlist_total + 1
RSlist.MoveNext
Wend
' reset the cursor to the beginning
If (RSlist.CursorType > 0) Then
RSlist.MoveFirst
Else
RSlist.Requery
End If
' set the number of rows displayed on this page
If (RSlist_numRows < 0 Or RSlist_numRows > RSlist_total) Then
RSlist_numRows = RSlist_total
End If
' set the first and last displayed record
RSlist_first = 1
RSlist_last = RSlist_first + RSlist_numRows - 1
If (RSlist_first > RSlist_total) Then
RSlist_first = RSlist_total
End If
If (RSlist_last > RSlist_total) Then
RSlist_last = RSlist_total
End If
End If
%>
<html>
<body bgcolor="#ccffcc">
<%
Request.Form("map"

Request.Form("region"

Request.Form("map"

Request.Form("county"

'Request.Form("manager_name"

'Request.Form("business_type"

Response.Write(Request.Form("county"

Response.Write(Request.Form("manager_name"

Response.Write(Request.Form("business_type"

if Request.Form("region"


if Request("county"


Query ="SELECT * FROM companys WHERE county LIKE '%" & Request("county"



Set DataConn = Server.CreateObject("ADODB.Connection"

DataConn.Open "dbireland"
Set RSlist = Server.CreateObject("ADODB.recordset"

RSlist.Open Query,DataConn,1,2
%>
<table >
<tr><td><b>Results</b></td></tr>
<%Do While Not RSlist.EOF%>
<tr><td><strong>Company Name</strong></td><td><%=RSlist("company_name"

<tr><td><strong>Manager Name</strong></td><td><%=RSlist("manager_name"

<tr><td><strong>Contact Name</strong></td><td><%=RSlist("contact_name"

<tr><td><strong>Email</strong></td><td><a href="mailto:<%=RSlist("email"


<tr><td><strong>Website</strong></td><td><a href="http:\\<%=RSlist("url"


<tr><td><strong>Phone</strong></td><td><%=RSlist("phone_one"

<tr><td><strong>Alternative phone</strong></td><td><%=RSlist("phone_two"

<tr><td><strong>Address</strong></td><td><%=RSlist("address_one"

<tr><td> </td><td><%=RSlist("address_two"

<tr><td> </td><td>Co. <%=RSlist("county"

<tr><td><strong>Region</strong></td><td><%=RSlist("region"

<tr><td><strong>Business Type</strong></td><td><%=RSlist("business_type"

<% If RSlist("MeetingDocs_Name"



<%RSlist.Movenext
Loop%>
<tr>
<td> Records <%=(RSlist_first)%> to <%=(RSlist_last)%> of <%=(RSlist_total)%> </td>
</tr>
</table>
</body>
</html>