문제

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!

올바른 솔루션이 없습니다

다른 팁

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")
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top