Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linq #datatable
ADD COMMENT
Topic
Name
6+4 =