LINQ query on a DataTable

前端 未结 23 1389
执笔经年
执笔经年 2020-11-22 01:59

I\'m trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example:

23条回答
  •  迷失自我
    2020-11-22 02:09

    Using LINQ to manipulate data in DataSet/DataTable

    var results = from myRow in tblCurrentStock.AsEnumerable()
                  where myRow.Field("item_name").ToUpper().StartsWith(tbSearchItem.Text.ToUpper())
                  select myRow;
    DataView view = results.AsDataView();
    

提交回复
热议问题