如何篩選DataTable資料

摘要:如何篩選DataTable資料


DataView dv = new DataView(dt);

dv.RowFilter = "nodeid = 1"; //放篩選條件

foreach (DataRowView drv in dv) //記住這邊是DataRowView 後面是 dv
{
   Console.WriteLine(drv[0].ToString());
}