Datatable select with multiple conditions

前端 未结 7 1972
再見小時候
再見小時候 2020-12-02 17:03

I have a datatable with 4 columns A, B, C and D such that a particular combination of values for column A, B and C is unique in the datatable.

Objective:

相关标签:
7条回答
  • 2020-12-02 17:36

    Do you have to use DataTable.Select()? I prefer to write a linq query for this kind of thing.

    var dValue=  from row in myDataTable.AsEnumerable()
                 where row.Field<int>("A") == 1 
                       && row.Field<int>("B") == 2 
                       && row.Field<int>("C") == 3
                 select row.Field<string>("D");
    
    0 讨论(0)
提交回复
热议问题