Example
string StudentName = "foo";
DataTable dt = new DataTable();
int id = (from DataRow dr in dt.Rows
where (string)dr["StudentName"] ==
StudentName
select (int)dr["id"]).FirstOrDefault();
Example
DataRow[]
result = datatable.Select("age >= 18");
foreach (DataRow row in result)
{
Console.WriteLine("{0},
{1}", row[0], row[1]);
}
by LINQ
var results = from myRow in myDataTable.AsEnumerable()where myRow.Field<int>("RowNo") == 1 select myRow;