Can anyone point me to a code example where a recordset.absol utepage is sorted independantly of the original recordset. That is; if I populate an ADO recordset with an ORDER BY ListingDate clause, and I need to (subsort) recordset.absol utepage five of my paging on another field, say for example AskingPrice, I'm stuck.
My goal is for my users to be able to page through my recordset, sort a page if desired, and continue through the recordset. The records on any page are sorted, and the same records are displayed, just in a new (subsort) oder.
I'm not using the data controls, just plain ASP...
Thanks
Kev
Current code below...
<!--#include file="Utilities .asp"-->
<link href="styles/main.css" rel="stylesheet " type="text/css">
<!--#include file="header.as p"-->
<!--#include file="Menu.asp"-->
<%
check_security( 2)
%>
<%
If Session("UserID ") = "" Then
Response.Redire ct "Login.asp"
End if
Dim rsItems, strSort
strSort = request("sortby ")
strSQL = "SELECT Item.ItemID, Users.CompanyNa me, EquipmentTypes. EquipName, Item.EquipmentT ype, Item.LoadSize, Item.PickupDate , Item.SPCountry, Item.SPState, " & _
"Item.SPCit y, Item.DPCountry, Item.DPState, Item.DPCity, Item.Descriptio n, Item.AskingPric e, Item.SellerID, Item.ListingDat e, Item.Expiration Date, Item.ItemStatus " & _
"FROM (Item INNER JOIN EquipmentTypes ON Item.EquipmentT ype = EquipmentTypes. EquipCode) LEFT JOIN Users ON Item.SellerID = Users.UserID " & _
"WHERE Item.Expiration Date > #" & FormatDateTime( Now,2) & "# " & _
"AND ItemStatus = 'Active' "
If request("LoadSi ze") <> "" then
strSQL = strSQL & "AND LoadSize = '" & request("LoadSi ze") & "' "
End if
If request("Equipm entType") <> "" then
strSQL = strSQL & "AND EquipmentType = '" & request("Equipm entType") & "' "
End if
If request("SPCoun try") <> "" then
strSQL = strSQL & "AND SPCountry = '" & request("SPCoun try") & "' "
End if
If request("SPStat e") <> "" then
strSQL = strSQL & "AND SPState = '" & request("SPStat e") & "' "
End if
If request("DPCoun try") <> "" then
strSQL = strSQL & "AND DPCountry = '" & request("DPCoun try") & "' "
End if
If request("DPStat e") <> "" then
strSQL = strSQL & "AND DPState = '" & request("DPStat e") & "' "
End if
strSQL = strSQL & "ORDER BY PickupDate;"
page_no = request("page_n o")
if page_no = "" then page_no = 1
Set rsItems = Server.CreateOb ject("ADODB.Rec ordset")
if strSql <> "" then
rsItems.CursorL ocation = 3
rsItems.CacheSi ze = 5
rsItems.Sort = "PickupDate , " & strSort
rsItems.Open strSql, objConn
if not rsItems.EOF then
rsItems.MoveFir st
rsItems.PageSiz e = 5
max_count = cInt(rsItems.Pa geCount)
num_recs = rsItems.RecordC ount
rsItems.Absolut ePage = page_no
results = true
for each tmp in request.queryst ring
if tmp <> "page_no" AND tmp <> "sortby" then
request_string = request_string & tmp & "=" & request.queryst ring(tmp) & "&"
end if
next
else
results = false
rsItems.Close
end if
else
results = false
end if
rec_count = 0
%>
<table cellpadding="0" cellspacing="0" >
<tr>
<td> </td>
</tr>
<tr>
<td><h1>Brows e Loads</h1></td>
</tr>
<tr>
<td><li>Click Company Name to bid on the load.</li>
<li>Click the column headers to sort each Pickup Date by the column name.</li>
<li>Place your mouse over the Type code to see the full type description.</li>
<li>You cannot bid on your own loads.</li></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<%
if results = true then
%>
<table width="760px" cellpadding='0' cellspacing='0' >
<tr>
<td class='tdHeader '>Company</td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=LoadS ize">Size</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Equip mentType">Type</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Picku pDate">Pickup Date</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=SPCit y">Starting Point</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=DPCit y">Destinati on</a></td>
<td class='tdHeader '><a href="<%=reques t.servervariabl es("script_name ")%>?<% =request_string %>page_no=<% =page_no %>&sortby=Askin gPrice">Payment Amt</a></td>
</tr>
<%
do while not rsItems.EOF AND (rec_count < rsItems.Pagesiz e)
on error resume next
%>
<tr>
<% If Session("UserID ") <> "" AND Session("UserID ") <> rsItems("Seller ID") Then %>
<td align="left" class='tdData'> <a href='Bid.asp?I tem=<%=rsItems( "ItemID")%>'><% =rsItems("ItemR eference")%></a></td>
<% Else %>
<td class='tdData' align='left'><% =rsItems("ItemR eference")%></td>
<% End If %>
<td class='tdData' align='center'> <%= rsItems("LoadSi ze") %></td>
<td class='tdData' align='center'> <a title='<%=rsIte ms("EquipName") %>'><%=rsItems( "EquipmentType" )%></a></td>
<td align='center' class='tdData'> <%= rsItems("Pickup Date")%></td>
<td align='left' nowrap class='tdData'> <a href="http://www.mapquest.co m/maps/map.adp?country =<%=rsItems("SP Country")%>&sta te=<%=rsItems(" SPState")%>&cit y=<%=rsItems("S PCity")%>&CID=l fmaplink" target="_blank" ><font color="#FF0000" size="1">Map</font></a> <%= rsItems("SPCity ") & ", " & rsItems("SPStat e")%></td>
<td align='left' nowrap class='tdData'> <a href="http://www.mapquest.co m/maps/map.adp?country =<%=rsItems("DP Country")%>&sta te=<%=rsItems(" DPState")%>&cit y=<%=rsItems("D PCity")%>&CID=l fmaplink" target="_blank" ><font color="#FF0000" size="1">Map</font></a> <%= rsItems("DPCity ") & ", " & rsItems("DPStat e") %></td>
<td class='tdData' align='right'>< %= formatcurrency( rsItems("Asking Price")) %> </td>
</tr>
<%
rsItems.MoveNex t
rec_count = rec_count + 1
loop
rsItems.Close
Set rsItems = Nothing
%>
</table>
<% else %>
<center>
<h2>No loads currently listed</h2>
</center>
<%
end if
if max_count > 1 then
%>
<table width="760px" cellpadding="0" cellspacing="0" class="NavTable ">
<tr>
<td align=center width="20%" class=NavFont>< % if page_no > 1 then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=1&sor tby=<% =request("sortb y")%>">First </a>
<% else %>
<% end if %>
</td>
<td align=center width="20%" class=NavFont>< % if page_no > 1 then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =page_no-1 %>&sortby=<%=re quest("sortby") %>">Previous</a>
<% else %>
<% end if %>
</td>
<td align=center width="20%" class=NavFont> Records: < %=num_recs%> </td>
<td align=center width="20%" class=NavFont>< % if cInt(page_no) < cInt(max_count) then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =page_no+1 %>&sortby=<% =request("sortb y")%>">Next</a>
<% end if %>
</td>
<td align=center width="20%" class=NavFont>< % if cInt(page_no) < cInt(max_count) then %>
<a class=HeaderFon t href="<% =request.server variables("scri pt_name") %>?<% =request_string %>page_no=<% =cInt(max_count ) %>&sortby=<% =request("sortb y")%>">Last</a>
<% end if %>
</td>
</tr>
</table>
<% end if %>
<!--#include file="footer.as p"-->