Question:Which of the following is the correct way to perform a LINQ query on a DataTable object? 

A var results = from myRow in myDataTable where results.Field("RowNo") == 1 select results; 

B var results = from myRow in myDataTable.AsEnumerable() where myRow.Field("RowNo") == 1 select myRow; 

C var results = from myRow in myDataTable.Rows where myRow.Field<int>("RowNo") == 1 select myRow; 

D var results = from myRow in myDataTable.AsEnumerable() where myRow.Field<int>("RowNo") == 1 select new { IID= myRow.Field<int>("IID"), Date = myRow.Field<DateTime>("Date"), }; 

+ Answer
+ Report
Total Preview: 742

Copyright © 2024. Powered by Intellect Software Ltd