通过Select查询得到的n行3列已经Fill到一个DataTable中,怎么取得这个DataTable每行每列的值?

解决方案 »

  1.   

    DataTable dt = new DataTable();
    for (int i = 0;i < dt.Rows.Count;i++)
    {
    for (int j = 0;j < dt.Columns.Count;j++)
    {
    dt.Rows[i][j]
    }
    }
      

  2.   

    new一个DataTable
    .Rows[index][index]指定
      

  3.   

    msdn里面的
    DataRow[] currRows = workDataTable.Select(null, null, DataViewRowState.CurrentRows);if (currRows.Length < 1 )
      Console.WriteLine("No Current Rows Found");
    else
    {
      foreach (DataRow myRow in currRows)
      {
        foreach (DataColumn myCol in workTable.Columns)
          Console.Write("\t{0}", myRow[myCol]);    }
    }