Forums
This topic is locked
Sorting Results on a page
Posted 05 Jun 2002 00:33:39
1
has voted
05 Jun 2002 00:33:39 Jeff Hansen posted:
Ok, i am using MX and attemping to sort the results of an SQL querie. Not sure how to get what I wnat on the page. Basically, I have many events associated with many users. I want the page to use a repeat region of some sort to show the users names once, then the events that are assocated to them repeated below. I cant use a nested repeat region, so i am driving myself crazy trying to figure this out. any help would be very appreciated!!
Jeff
Replies
Replied 11 Jun 2002 17:37:20
11 Jun 2002 17:37:20 Tolu Ayoola replied:
I'm not sure exactly what you mean but I did the sorting thing and it worked but it didn't show up as a recordset on the recordset table but it does exist..
< %
Dim Order
Dim Sort
Dim str
Dim strOrder
Dim strSort
Order = Request.QueryString("Order"
Sort = Request.QueryString("Sort"
If Order <> "" Then
strOrder = Order
Else
strOrder = "date"
End If
If Sort <> "" Then
strSort = Sort
Else
strSort = "DESC"
End If
str = strOrder & " " & strSort
Dim sql
sql = "SELECT member_id, first_name, last_name, major, user_name FROM Members ORDER BY " & str
% >
< %
set rsMembers = Server.CreateObject("ADODB.Recordset"
rsMembers.ActiveConnection = MM_cnAdmMemNewPicSpon_STRING
rsMembers.Source = sql
rsMembers.CursorType = 0
rsMembers.CursorLocation = 2
rsMembers.LockType = 3
rsMembers.Open()
rsMembers_numRows = 0
% >
And on the buttom that sorts it out..
< a href="default.asp?Order=last_name&Sort=DESC" >< img src="../images/uses/down_arrow.gif" width="15" height="15" border="0" >< /a>
The initial fright of failure is the beginning of failure itself -Tolu
< %
Dim Order
Dim Sort
Dim str
Dim strOrder
Dim strSort
Order = Request.QueryString("Order"
Sort = Request.QueryString("Sort"
If Order <> "" Then
strOrder = Order
Else
strOrder = "date"
End If
If Sort <> "" Then
strSort = Sort
Else
strSort = "DESC"
End If
str = strOrder & " " & strSort
Dim sql
sql = "SELECT member_id, first_name, last_name, major, user_name FROM Members ORDER BY " & str
% >
< %
set rsMembers = Server.CreateObject("ADODB.Recordset"
rsMembers.ActiveConnection = MM_cnAdmMemNewPicSpon_STRING
rsMembers.Source = sql
rsMembers.CursorType = 0
rsMembers.CursorLocation = 2
rsMembers.LockType = 3
rsMembers.Open()
rsMembers_numRows = 0
% >
And on the buttom that sorts it out..
< a href="default.asp?Order=last_name&Sort=DESC" >< img src="../images/uses/down_arrow.gif" width="15" height="15" border="0" >< /a>
The initial fright of failure is the beginning of failure itself -Tolu