Click here to Skip to main content
14,865,088 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
I am facing a problem below is my code for sorting a dataset
but i am geting channel id in below format
for asc:-1,14,15,16,3
for DESc:-3,16,15,14,1
From ds2 dataset
PLease suggest

DataSet fileTransferDetail = APIs.GetDataSet(getResponse);
DataSet ds2 = new DataSet();//Declare a dataSet to be filled.
//Sort data.
fileTransferDetail.Tables[2].DefaultView.Sort = "channelid ASC";
//Store in new Dataset
Updated 13-Feb-14 3:03am
Raj tilak Bose 13-Feb-14 9:08am
I want data in order like (1,3,14,15,16)
ZurdoDev 13-Feb-14 9:10am
It's because it sees your data as a string, not a number.
Raj tilak Bose 13-Feb-14 9:14am
Any solution for that plz
idenizeni 13-Feb-14 12:02pm
If you reply to a comment the user will get an alert, it looks like you posted the comment to your original question. As for your issue, like RyanDev said, if you type the channelid column as a number the sorting will happen as you expect. When data is typed as a string and you sort numbers you get sorting like you are currently getting. If you can, change the datatype at the source data store or when you load the data into its table set the columns type to a number.
Prasad Avunoori 14-Feb-14 4:20am
Yes, Convert the datatype to Int in backend.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900