datatable linq c# code example
Example 1: C# create DataTable
DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("Name");
dt.Columns.Add("Marks");
DataRow _ravi = dt.NewRow();
_ravi["Name"] = "ravi";
_ravi["Marks"] = "500";
dt.Rows.Add(_ravi);
Example 2: c# datatable to linq
var results = from myRow in myDataTable.AsEnumerable()
where myRow.Field<int>("RowNo") == 1
select myRow;
Example 3: linq datatable
int id = 1;
DataRow r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).FirstOrDefault();
List<DataRow> r = (from DataRow m in myTable.Rows where m.Field<int>("col_name") == id select m).ToList();
Example 4: datatables.net
Javascript123$(document).ready( function () { $('#myTable').DataTable();} );