473,441 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,441 software developers and data experts.

Sorting Database Table in sql server 2000

49
Hello,
(Sql Server 2000 & ASP)

There is one table in my data base with 20 rows and 8 columns.and i wnat to Sort those data when i click Cloumns individually.Suppose when i click First column in my table the total data in the table will be sorted.What is the code for that in Asp with sql server 2000.

Thanks,
Nagesh.
Aug 30 '08 #1
4 2279
JamieHowarth0
533 Expert 512MB
Can a mod please move this to ASP forum and I will then help the poster accordingly as this is not a SQL Server question.

Regards,

medicineworker
Aug 30 '08 #2
JamieHowarth0
533 Expert 512MB
Hi Nagesh,

Firstly, you need to display the column headings in a table-like structure, then for each column heading, you need to set the heading to be a link, and pass a parameter (e.g. orderby=column-name).
Then, in your SQL code in your ASP page, you do a test to see whether the column to be ordered by has been specified:

Expand|Select|Wrap|Line Numbers
  1. If Request.QueryString("order-by") <> "" Then
  2.     If Request.QueryString("order-dir") <> "" Then
  3.         strSQL = strSQL + " ORDER BY " + Request.QueryString("order-by") + " " + Request.QueryString("order-dir")
  4.     Else
  5.         strSQL = strSQL + " ORDER BY " + Request.QueryString("order-by")
  6.     End If
  7. End If
  8.  
Then, your links will look something like this:
Expand|Select|Wrap|Line Numbers
  1. <tr>
  2. <td><a href="yourpage.asp?order-by=title&order-dir=asc">Title</a></td>
  3. <td><a href="yourpage.asp?order-by=FName&order-dir=asc">FName</a></td>
  4. <td><a href="yourpage.asp?order-by=LName&order-dir=asc">LName</a></td>
  5. etc. etc.
  6. </tr>
  7.  
Hope this helps.

Best regards,

medicineworker
Sep 6 '08 #3
imtmub
112 100+
Use grid view function in asp. you can sort any column.
Sep 8 '08 #4
DrBunchman
979 Expert 512MB
Use grid view function in asp. you can sort any column.
The GridView is used in ASP.NET not Classic ASP.

Dr B
Sep 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
12
by: CJM | last post by:
How can I dynamically sort the results from a Stored Procedure? Or more importantly, what is the fastest and most efficient way? I know I can do the sorting within the recordset in ASP, but AFAIK...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
4
by: Mark Travis | last post by:
Hi all, I have written a simple Web Application that displays a query result onto a page using the ASP DataGrid. To Digress ======= Development information about the page is as follows 1....
0
by: Roy | last post by:
Hey all, I must be losing my touch. I have made many pages in the 1.1 framework that utilize custom bidirectional paging in datagrids. We've converted over to 2.0 and I've been trying to use the...
3
by: Don | last post by:
I'm using Access 2000. My database collects lots and lots of data. One aspect of that is to collect dimensional data from multiple checks during the day. The way I've done that is to have a...
2
by: Bob Laubla | last post by:
Hello I have a very complex maketable query with many records and involving multiple VB functions which call other functions. I need this table to be sorted by the first field. But no matter what...
3
by: Larry Leonard | last post by:
Running MSDE 2000 SP2 on Windows XP SP3. I have a T-SQL script that is relatively simple (adding constraints, inserting rows, etc.) and short (maybe 300 lines, heavily commented). It's an...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
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...

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.