| 12:16 pm on May 6, 2002 (gmt 0)|
if you are already using ASP, I would make the click on the column heading another server call, with the appropriate change in the ORDER BY clause of your SQL. You can use directives for this:
<a href="mypage.asp?Sort1">Sort 1</a>
<a href="mypage.asp?Sort2">Sort 2</a>
In your ASP code:
if Request.QueryString == "Sort1" then
sql = sql & " order by field1"
elseif Request.QueryString == "Sort2" then
sql = sql & " order by field2"
Much faaster than trying to do it client side.
I can show you an example if you sticky me.
| 12:33 pm on May 6, 2002 (gmt 0)|
Thanks for the solution,Can u send me the example? I have a concern. Won't I be hitting the database everytime I sort ,which will reduce the response time.
| 12:50 pm on May 6, 2002 (gmt 0)|
There is another style of sorting algo called "quicksort" [ciips.ee.uwa.edu.au]. It is faster than "bubble sort" because it works by creating partitions in the data, and sorting within each partition, rather than the inefficient side-by-side sorting of all elements.
| 6:01 pm on May 6, 2002 (gmt 0)|
I'm not sure how long this URL will last here (we don't generally like to post URLs on WW) but if you can get to it you'll see what I do.
Clicking on a column heading will go back to the db and bring it back in a different sort.
Yes, it takes resources, but the server side processing is generally much faster than client side processing.
(edited by: tedster at 6:15 pm (utc) on May 6, 2002)
| 8:10 pm on May 6, 2002 (gmt 0)|
I'd suggest you see if you can pre-sort and then cache the result sets based on all of the possible combinations. Superfast response time because there's no need to sort. You'll need to choose an appropriate time period for updating the cached results based upon how often you update the db.
| 4:28 am on May 8, 2002 (gmt 0)|
Thanks for the URL, I was able to view it. Can u send me the pmlb.asp file coz' I get the following error when I tried to achieve the same
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.