問題:
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. 我試圖對DataTable對象執行LINQ查詢,但奇怪的是,我發現對DataTables執行此類查詢並不簡單。 For example: 例如: this
var results = from myRow in myDataTable where results.Field("RowNo") == 1 select results;
This is not allowed. 這是不容許的。 How do I get something like this working? 如何得到相似的效果? spa
I'm amazed that LINQ queries are not allowed on DataTables! 我很驚訝在數據表上不容許使用LINQ查詢! .net
解決方案:
參考一: https://stackoom.com/question/2p5/數據表上的LINQ查詢參考二: https://oldbug.net/q/2p5/LINQ-query-on-a-DataTable