Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic 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 September 6th, 2003, 01:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default page count , problem in loop

Ther is problem in loop.
First page is properly display, when I click No 2 or No 3 (page no) it give following error message.

Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/dcil2/tripimages/contno2a.asp, line 114

Contractno and contractno1 value received from previous page.
I use two condition, if ssql=contractno then do this end if or if ssql=contractno1 then do this end if
It is display first page, but when I click next page ie. 2 it give error.
How can use page count (pn) value in the following coding (loop) ?


set cn=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
cn.ConnectionString="Provider=SQLOLEDB.1;Integrate d Security=SSPI;Persist Security Info=False;Initial Catalog=dcil;Data Source=dcil2"
cn.Open

contractno=Request.Form("contractno")
contractno1=Request.Form("contractno1")

ssql=contractno+contractno1

if ssql=contractno then

rs.Open "SELECT contractno,recordno,category,contractor,consultant ,Description,drawingno,approveddate, REVERSE(LEFT(REVERSE(Imagereference), CHARINDEX('\', REVERSE(Imagereference)) - 1)) imagereference FROM arc where contractno='"& contractno& "' order by recordno",cn,1,2
rs.PageSize=100

Response.Write("Total No of Records = "& rs.RecordCount&"<br>")
Response.Write("Total No of Pages @ "&rs.PageSize&" = "& rs.PageCount&"<br>")

pn=Request.QueryString("pn")

Response.Write("Page No = " & pn&"<br>")

if pn="" then
rs.AbsolutePage=1
else
rs.AbsolutePage=pn // line no 114 error line it not received pn value.
end if

pv=1

%>
<TABLE>
  <tr>
    <th>Contract No</th><th>Record Drawing No</th><th>Description</th><th>Drawing Category</th><th>Contractor</th><th>Consultant</th><th>Approved Date</th><th>ImageReference</th>
</tr>
  <%
Dim fielddata

do while rs.eof=false and pv<=rs.PageSize

Response.Write("<tr>")
Response.Write("<td bgcolor=lightyellow>" & rs("contractno") & "</td>")
Response.Write("<td>" & rs("recordno") & "</td>")
Response.Write("<td>" & rs("description") & "</td>")
Response.Write("<td>" & rs("category") & "</td>")
Response.Write("<td>" & rs("contractor") & "</td>")
Response.Write("<td>" & rs("consultant") & "</td>")

fieldData = rs("approveddate") & ""
If Len(fieldData) = 0 Then fieldData = " - "
Response.Write("<td align=center>" & fieldData & "</td>")

Response.Write("<td>")
Response.Write("<a href=" & server.URLEncode(rs("imagereference")) & ">" & rs("imagereference") & "</a>")
Response.Write("</td>")

Response.Write("<tr>")

pv=pv+1
rs.movenext
loop

for i=1 to rs.PageCount
%>

<a href=contno2a.asp?pn=<%=i%>><%=i%></a>
<%
next
end if
%>
</TABLE>


Mateen





Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Count problem myself Classic ASP Professional 1 July 20th, 2006 02:32 AM
Get count of a for loop austinf XSLT 1 May 16th, 2006 03:26 AM
Page Count kondapally Crystal Reports 0 April 13th, 2006 02:29 PM
is there any in built function to count page count g.tamilselvan MySQL 1 February 15th, 2006 07:43 AM
Page count goLynxgo Excel VBA 3 January 24th, 2005 01:52 PM





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