In my ASP page I have a SQL query that gives me a single field from a table. But the recordset is populated using the 1, 10, 11, 2 method... whatever you call it. I want it to go 1,2,3...10,11,
K, cept Des give me this error:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near 'DES'.
/includeSets.asp, line 143
And Asc still gives me this:
1
10
11
13
15
16
17
18
2
3
4
5
6
7
8
9
If you're still getting the records sorted like "1, 10, 11, 12" then you're probably not using a number data type for that field - more likely it's a string type. Check your data type.
Depends on the database you are using... their maybe some functions you can use which are part of your databases unique api. Brett Birkett B.Comp
Systems Analyst
Okay, I got it. Here's the final Search string. It takes the data which is saved as char and converts it to int, then of course sorts ascending. I'm so proud of myself.
SELECT Distinct ID = CONVERT(int, ID) FROM CustomerProducts WHERE CustomerID = '" & custid & "' AND ProgramID = '" & searchID & "' AND ID <> 'SLT' Order BY ID Asc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.