Question

I have a dataset in which there is a column contains various string type values like below:

Aircraft Crime Package Total Apartments DIC - Personnel

Now the requirement is that after applying sorting logic on this colum if there is a "Package Total" value in it then it must come at the top position on the Dataset and after that all other values should be in alphabatically sorted order like below:

Package Total Aircraft Apartments Crime DIC - Personnel

We have used in Database below logic which is working fine but can't figure it out how to do it on Dataset VB.net from Fronend side:

ORDER BY 
CASE WHEN UseCarrierAllocation = 0 THEN 
    CASE WHEN InvoiceItemLevel LIKE 'Package Total%' THEN 0 ELSE 1 
    END 
END, InvoiceItemLevel ASC

Any reply/idea will be helpful!

No correct solution

OTHER TIPS

Something like this might work for you:

    DataView dv = sDataSet.Tables("Table1").DefaultView;
    dv.Sort = "column1";
YourDatasourceName.YourDatasetName.DefaultView.Sort = "YourColumnName"

YourDataTableName = YourDatasourceName.YourDatasetName.DefaultView.ToTable(True, "YourColumnName")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top