Click to See Complete Forum and Search --> : ASP database problem


s_allamneni
03-15-2003, 09:54 PM
HI ,
I've a search program where i query for list of products matching some criteria(like productname). I would like to know how to display like 20 images from the result set per page rather than all images at a time. and i also want to know how to navigate to next page and prev page with out loosing result set information. thanks for your help.

s_allamneni
03-16-2003, 11:14 AM
Thank you for your help. let me try that automatic method.

s_allamneni
03-16-2003, 11:30 AM
HI Dave,


<form action="<%= strURL %>" method="get">
<input name="search" value="<%= strSearch %>" />
<B> OR </B>
<input name="number" value="<%= strNumber %>" />
<input type="submit" value="Go" />
</form>
---------other code----------
Set myRst = Server.CreateObject("ADODB.RecordSet")
myRst.CursorLocation = 3 ' needed for paging
myRst.PageSize = 10 ' number of comments per page
myRst.Open strSQL, cnnSearch, 2, 3
numPages = myRst.PageCount
'
curPage = CInt(Request.QueryString("Page")) ' pass desired page
If curPage < 1 Then curPage = 1
If curPage > numPages Then curPage = numPages
myRst.AbsolutePage = curPage ' start retrieval at desired page
%>
<h4>Page <%=curPage%> of <%=numPages%></h4>

<!--mstheme--></font><table border="1" bordercolordark="#000000" bordercolorlight="#000000">
<tr>
<th><!--mstheme--><font face="Verdana, Arial, Helvetica">ProductName<!--mstheme--></font></th>
<th><!--mstheme--><font face="Verdana, Arial, Helvetica">ProductNumber<!--mstheme--></font></th>
<th><!--mstheme--><font face="Verdana, Arial, Helvetica">ProductImage<!--mstheme--></font></th>
</tr>
<%
Do While myRst.AbsolutePage = curPage And NOT myRst.EOF
%>
<tr>
<td><!--mstheme--><font face="Verdana, Arial, Helvetica">
<%= myRst.Fields("ProductName").Value %>

<!--mstheme--></font></td>
<td><!--mstheme--><font face="Verdana, Arial, Helvetica">
<%= myRst.Fields("ProductNumber").Value %>
<!--mstheme--></font></td>
<td><!--mstheme--><font face="Verdana, Arial, Helvetica">

<img border="0" src="/charm_images/<%= myRst.Fields("ProductImage").Value %>.gif" width="100" height="150">

<!--mstheme--></font></td>
</tr>
<%

myRst.MoveNext
Loop
%>
</table><!--mstheme--><font face="Verdana, Arial, Helvetica">

<form onSubmit="return false;">
<input type="button" value="First Page" onClick="
self.location.href = '<%=Session("Page")%>?Page=1';
return true;">
<input type="button" value="Prev Page" onClick="
self.location.href = '<%=Session("Page")%>?Page=<%=(curPage-1)%>';
return true;">
<input type="button" value="Next Page" onClick="
self.location.href = '<%=Session("Page")%>?Page=<%=(curPage+1)%>';
return true;">
<input type="button" value="Last Page" onClick="
self.location.href = '<%=Session("Page")%>?Page=<%=numPages%>';
return true;">
</form>





this is the code i'm using for paged result set, first page is displaying the first ten results, but the navigation to (first,next,prev,last) pages are not working. Do i need to merge both forms? please help.

s_allamneni
03-16-2003, 12:54 PM
Hi Dave,
Never mind, i figure it out. i just need to send the search string to the (next,prev,firt,last) pages along with the page number.
thank you for your help.