You can add another column which contains a value to order by, and then order by that instead. Or remove the leading "Q", change the data type of the column to numeric, and only apply the "Q" when you display the data.
Or remove the leading "Q", change the data type of the column to numeric, and only apply the "Q" when you display the data.
I agree!
In fact you can only save numbers then you can do sorting,and then when showing all of the data contents,Just use the formation and do binding like this in the ItemTemplate:
itismesa
Member
232 Points
146 Posts
Custom Order BY
Aug 02, 2012 11:52 PM|LINK
hi
I have sql statement in Access retrun 12 records. Where I Order by Field1 I got the following values
Q1
Q10
Q11
Q12
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
I need the order to be
Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
Q11
Q12
How to do that custom order
thank u in advance
Mikesdotnett...
All-Star
154897 Points
19862 Posts
Moderator
MVP
Re: Custom Order BY
Aug 03, 2012 04:06 AM|LINK
You can add another column which contains a value to order by, and then order by that instead. Or remove the leading "Q", change the data type of the column to numeric, and only apply the "Q" when you display the data.
Beginning ASP.NET Web Pages with WebMatrix | My Site | Twitter
hans_v
All-Star
35986 Points
6550 Posts
Re: Custom Order BY
Aug 05, 2012 12:00 AM|LINK
ORDER BY CLng(Right([Field1], Len([Field1]) - 1))
But this is the better option
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Custom Order BY
Aug 05, 2012 01:35 AM|LINK
I agree!
In fact you can only save numbers then you can do sorting,and then when showing all of the data contents,Just use the formation and do binding like this in the ItemTemplate:
<%#Eval("BoundFieldName")%>