473,569 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Paging, Subsort...

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>&nbsp;</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>&nbsp;</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'> &nbsp;<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>&nbsp;<%= rsItems("SPCity ") & ", " & rsItems("SPStat e")%></td>
<td align='left' nowrap class='tdData'> &nbsp;<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>&nbsp;<%= rsItems("DPCity ") & ", " & rsItems("DPStat e") %></td>
<td class='tdData' align='right'>< %= formatcurrency( rsItems("Asking Price")) %>&nbsp;</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:&nbsp;< %=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"-->

Aug 2 '05 #1
1 1342
"Kevin" <ke***@Dearinge rAM.com> wrote in message
news:Ou******** ******@TK2MSFTN GP15.phx.gbl...
<snip>
Please do not multipost Kevin. This is definitely a database-related
question
so .asp.db was the perfect group in which to post it. Posting it here as
well did not increase your chances of getting an answer (most of us
subscribe to both groups). On the contrary, if somebody had taken his time
to answer it here, only to find that it was already resolved in the other
group, that person may have been annoyed enough to ignore any future posts
from you, thereby decreasing your chances of getting help in the future.

There are times when you will not be sure which group is most appropriate,
and you will want to post a question to both groups. In that situation, you
should use the cross-posting technique, rather than posting the same message
multiple times. To crosspost, put a semicolon-delimited* list of the
newsgroups to which you wish to post in the To: header of your post and post
it once. It, and any replies to it, will appear in all the newsgroups in
your list. So, if I reply in .asp.db, my reply will also appear here in
..asp.general.

* ... or whatever delimiter is recognized by your news client
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From header is
my spam trap, so I don't check it very often. You will get a quicker
response by posting to the newsgroup.
Aug 2 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2719
by: ck388 | last post by:
For some reason when I enable the callback feature of the gridview I still get a page refresh, that is it seems like there is a postback that occurs, not a callback which is just supposed to update not the whole page, but a portion of the page. Strangely enough the URL below ...
6
1803
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every...
2
2212
by: asad | last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom paging bcoz data is too heavy so pls tell me how can i use custom paging in ASP.NET Thanks
0
958
by: Kevin | last post by:
Can anyone point me to a code example where a recordset.absolutepage 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.absolutepage five of my paging on another field, say for example AskingPrice, I'm stuck. My goal is for my users...
2
6440
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is begin and occured .I want to separate this code and compiling .vb code using VBC.exe later .(bin/paging.dll) when do it like me so you retrive only <...
0
3375
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server 2005 and the likes of it. So This one works with SQL2000 What do you think?
2
1919
by: rn5a | last post by:
In a shopping cart app, a ASPX page retrieves the order details & personal details of a user from a MS-Access database table depending upon the username of the user. The order details of a particular order (like ProductID, Name, Description, Quantity etc.) are displayed in one DataGrid where as the personal details of the buyer...
3
3733
by: Ronald S. Cook | last post by:
I was told that if calling lots of records from the database (let's say 100,000), that the GridView's paging feature would automatically "handle" everything. But the 100,000 records are still coming to the client, right? I mean, the paging feature isn't somehow making calls to the database for 25 records at a time or anything like that...
5
3202
by: Donald Adams | last post by:
Hi, I will have both web and win clients and would like to page my data. I could not find out how the datagrid control does it's paging though I did find some sample code that says they do it this way, but I can't see these methods as public. BookmarksDataSetTableAdapters.BookmarksTableAdapter bookTA = new...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.