|
-
Nov 2nd, 2000, 04:57 PM
#1
Thread Starter
New Member
I am wanting to allow the user to click Sort Ascending or Sort Descending and have a datagrid sort by name accordingly. How can this be done w/ SQL or is there an easier way to do this?
Thanks
-
Nov 2nd, 2000, 05:26 PM
#2
Hyperactive Member
At the end of your SQL statement use the ORDER BY clause and select the field you wish to order by eg.
Select * from Customers
Order By LastName
You can also specify Asc/Desc dependiong on which you want, default is Asc.
-
Nov 6th, 2000, 11:45 AM
#3
Thread Starter
New Member
VB and SQL
Here is a sample of the code I am using.....Right now I have menu as follows....
Sort
Sort Asc
Sort Desc
But when I click these nothing happens
Here is the code in the Sort Desc routine
cDbase = "C:\PhoneDirectory.mdb"
cTable = "Directory"
cSort = " ORDER BY "
cField = ""
cSelect = "SELECT * FROM "
cTry = "SORT DESC"
Adodc1.RecordSource = cSelect + cTable + cSort + "Name"
DataGrid1.Refresh
Any suggestions?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|