Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Intermediate
May 21, 2001

Order By Column Not Row with rs.Getrows


This ASP script will enable you to order your database by columns instead of the default by rows, which is not easy on the eye. Due to the way HTML tables are written in code, you can only return the results in this order.

Here we set the recordset to an array with a 3-column table, ordered by column. This is useful for displaying well ordered, easy-to-view results.
 
<%
' ##### Create Array Of The Recordset
rcount = rs.RecordCount
Dim myarray()
pos = 0
increment = 0
rcount = cint(rcount)
startpos = 0
balance = 0
pos = 0
dcount = rcount / 3
if rcount mod 3 <> 0 then dcount=int(dcount)+1
ReDim myarray(dcount,3,4)
For i = 1 To rcount
if i<= dcount then
myarray(i,1,1) = rs.FIELDS(2).VALUE
myarray(i,1,2) = rs(
Wayne Johnson
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap