LINQ query on a DataTable C#
var results = from myRow in myDataTable.AsEnumerable()
where myRow.Field<int>("RowNo") == 1
select myRow;
LINQ query on a DataTable C#
var results = from myRow in myDataTable.AsEnumerable()
where myRow.Field<int>("RowNo") == 1
select myRow;
linq datatable
//Reference System.Data.DataSetExtensions
//Be carefull to data types
int id = 1;
//one row
DataRow r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).FirstOrDefault();
//list of rows
List<DataRow> r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).ToList();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us