|
 |
asp_databases thread: paging of database!!
Message #1 by "rock" <kapinjal@m...> on Thu, 31 May 2001 04:37:25
|
|
Hi guys!!
well this is simple paging from database..but i dont know whats wrong with
my code..cant figure it out...if anyone can help me that...will be
appreciated...
the problem is that when i click on "next" link i doesnt show anything to
me..though there are more records to be shown in the next pages...
the code is :
<form action="<%=strURL%>" method="get">
<%
if currentpage = "" then
currentpage = 1
end if
searchfor = request("searchfor")
aim = request("purpose")
if request.servervariables("http_referer")
= "http://tcswebserver:8031/search.asp" then
aim = request("aim")
end if
minage = request("minage")
maxage = request("maxage")
location = request("location")
set conn = server.createobject("ADODB.Connection")
set rs = server.createobject("ADODB.Recordset")
conn.open session("constr")
if request.form("location") <> "any" then
resultqry = "select * FROM member where "
resultqry = resultqry & " myselfID = '" & searchfor &"' and "
resultqry = resultqry & " aimID like '%" & aim & "%' and "
resultqry = resultqry & " age between '" & minage & "' and '" &
maxage & "' and "
resultqry = resultqry & " state = '" & location & "' "
resultqry = resultqry & " order by age "
else
resultqry = "select * FROM member where "
resultqry = resultqry & " myselfID = '" & searchfor &"' and "
resultqry = resultqry & " aimID like '%" & aim & "%' and "
resultqry = resultqry & " age between '" &
minage & "' and '" & maxage & "' "
resultqry = resultqry & " order by '" & age & "' "
end if
rs.cursortype = adopenstatic
rs.pagesize = 4
rs.open resultqry, conn, 3
response.write "currentpage : " & currentpage & "<br>"
if currentpage <> 1 then %>
<div align="center"><a href="search.asp?currentpage=<%
=request.querystring("currentpage")-1%>&searchfor=<%=searchfor%>&aim=<%
=aim%>&minage=<%=minage%>&maxage=<%=maxage%>&location=<%=location%
>">Previous</a></div>
<% else %>
Previous
<% end if %>
<% if cint(currentpage) <> cint(rs.pagecount) and rs.pagecount <>
0 then %>
<div align="right"><a href="search.asp?currentpage=<%
=currentpage+1%>&searchfor=<%=searchfor%>&aim=<%=aim%>&minage=<%=minage%
>&maxage=<%=maxage%>&location=<%=location%>">Next</a></div>
<% else %>
Next
<% end if %>
<% if rs.bof and rs.eof then
response.write "<div align=center>No records found!!</div>"
else
if not rs.bof then
rs.absolutepage = cint(currentpage)
rowcount = 0
while not rs.eof and rowcount < rs.pagesize %>
<h5> &nb
sp;
<a href="showmemberdetail.asp?userID=<%=rs("userID")%>"><% = rs
("headline") %></a></h5>
<div align="center">
<center>
<table border="2" width="80%" bordercolor="#D7B8F0"
height="168">
<tr>
<td width="12%" rowspan="4"
bordercolor="#FFFFFF" valign="middle" height="162">
<% if rs("picture") <> "" then %>
<a
href="showmemberdetail.asp?userID=<%=rs("userID")%>"><img
src="file://Tcswebserver/webdata/www.adultfriendfinder.com.au/picture/<%=rs
("picture")%>" width="65" height="80" border="1"></a>
<% else %>
<p><img
src="file://Tcswebserver/webdata/www.adultfriendfinder.com.au/picture/nopho
to.gif" width="65" height="80" border="1">
<% end if %>
</td>
<td width="88%" bordercolor="#FFFFFF"
height="44"><b>User : </b><% = rs("username") %></td>
</tr>
<tr>
<td width="88%" bordercolor="#FFFFFF"
height="43"><b>Age : </b><% = rs("age") %></td>
</tr>
<tr>
<td width="88%" bordercolor="#FFFFFF"
height="43"><b>Location : </b><% = rs("state") %> , <% = rs
("country") %></td>
</tr>
<tr>
<td width="88%" bordercolor="#FFFFFF"
height="14"><b>Last Activity : </b><% = rs("lastactivity") %></td>
</tr>
</table>
<%
rowcount = rowcount + 1
rs.movenext
wend
end if
end if
%>
</center>
</div>
</form>
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 31 May 2001 19:01:05 +1000
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Hi guys!!
:
: well this is simple paging from database..but i dont know whats wrong with
: my code..cant figure it out...if anyone can help me that...will be
: appreciated...
:
: the problem is that when i click on "next" link i doesnt show anything to
: me..though there are more records to be shown in the next pages...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sorry, but I'm not reading through 300 lines of code to try and find your
error.
Is *any* error message displayed at all? Do you have On Error Resume Next
anywhere (if so, take it out).
Cheers
Ken
: the code is :
:
:
:
: <form action="<%=strURL%>" method="get">
: <%
: if currentpage = "" then
: currentpage = 1
:
: end if
:
: searchfor = request("searchfor")
: aim = request("purpose")
:
: if request.servervariables("http_referer")
: = "http://tcswebserver:8031/search.asp" then
: aim = request("aim")
: end if
:
: minage = request("minage")
: maxage = request("maxage")
: location = request("location")
:
: set conn = server.createobject("ADODB.Connection")
: set rs = server.createobject("ADODB.Recordset")
: conn.open session("constr")
:
: if request.form("location") <> "any" then
: resultqry = "select * FROM member where "
: resultqry = resultqry & " myselfID = '" & searchfor &"' and "
: resultqry = resultqry & " aimID like '%" & aim & "%' and "
: resultqry = resultqry & " age between '" & minage & "' and '" &
: maxage & "' and "
: resultqry = resultqry & " state = '" & location & "' "
: resultqry = resultqry & " order by age "
: else
: resultqry = "select * FROM member where "
: resultqry = resultqry & " myselfID = '" & searchfor &"' and "
: resultqry = resultqry & " aimID like '%" & aim & "%' and "
: resultqry = resultqry & " age between '" &
: minage & "' and '" & maxage & "' "
: resultqry = resultqry & " order by '" & age & "' "
: end if
: rs.cursortype = adopenstatic
: rs.pagesize = 4
:
: rs.open resultqry, conn, 3
: response.write "currentpage : " & currentpage & "<br>"
: if currentpage <> 1 then %>
: <div align="center"><a href="search.asp?currentpage=<%
: =request.querystring("currentpage")-1%>&searchfor=<%=searchfor%>&aim=<%
: =aim%>&minage=<%=minage%>&maxage=<%=maxage%>&location=<%=location%
: >">Previous</a></div>
: <% else %>
: Previous
: <% end if %>
:
: <% if cint(currentpage) <> cint(rs.pagecount) and rs.pagecount <>
: 0 then %>
: <div align="right"><a href="search.asp?currentpage=<%
: =currentpage+1%>&searchfor=<%=searchfor%>&aim=<%=aim%>&minage=<%=minage%
: >&maxage=<%=maxage%>&location=<%=location%>">Next</a></div>
: <% else %>
: Next
: <% end if %>
:
: <% if rs.bof and rs.eof then
: response.write "<div align=center>No records found!!</div>"
: else
: if not rs.bof then
: rs.absolutepage = cint(currentpage)
: rowcount = 0
:
: while not rs.eof and rowcount < rs.pagesize %>
:
:
:
:
: <h5> &nb
: sp;
: <a href="showmemberdetail.asp?userID=<%=rs("userID")%>"><%
rs
: ("headline") %></a></h5>
: <div align="center">
: <center>
: <table border="2" width="80%" bordercolor="#D7B8F0"
: height="168">
: <tr>
: <td width="12%" rowspan="4"
: bordercolor="#FFFFFF" valign="middle" height="162">
: <% if rs("picture") <> "" then %>
: <a
: href="showmemberdetail.asp?userID=<%=rs("userID")%>"><img
:
src="file://Tcswebserver/webdata/www.adultfriendfinder.com.au/picture/<%=rs
: ("picture")%>" width="65" height="80" border="1"></a>
: <% else %>
: <p><img
:
src="file://Tcswebserver/webdata/www.adultfriendfinder.com.au/picture/nopho
: to.gif" width="65" height="80" border="1">
: <% end if %>
: </td>
: <td width="88%" bordercolor="#FFFFFF"
: height="44"><b>User : </b><% = rs("username") %></td>
: </tr>
: <tr>
: <td width="88%" bordercolor="#FFFFFF"
: height="43"><b>Age : </b><% = rs("age") %></td>
: </tr>
: <tr>
: <td width="88%" bordercolor="#FFFFFF"
: height="43"><b>Location : </b><% = rs("state") %> , <% = rs
: ("country") %></td>
: </tr>
: <tr>
: <td width="88%" bordercolor="#FFFFFF"
: height="14"><b>Last Activity : </b><% = rs("lastactivity") %></td>
: </tr>
: </table>
: <%
: rowcount = rowcount + 1
: rs.movenext
: wend
: end if
: end if
: %>
: </center>
: </div>
: </form>
:
: ---
: * Fast, Full-Featured Microsoft® Excel Web Reports & Charts!
: A breakthrough in high performance Web application development,
SoftArtisans
: ExcelWriter 1.1 supports native Excel charting, image insertion, and
: advanced functions & formatting. One click generates presentation-quality
: Excel spreadsheets-and ExcelWriter performs over 100 times faster than the
: Excel Object. Several editions, including ExcelWriterFREE, are available.
:
URL:<http://adtracking.wrox.com/track.asp?x=p2p%2Fe%2Fd%26w%2Fsoftart&url=ht
tp://www.softartisans.com/softartisans/excelwriter.html>
$subst('Email.Unsub')
|
|
 |