Looping through a DataTable

前端 未结 4 808
無奈伤痛
無奈伤痛 2021-02-07 03:51

Well. I have a DataTable with multiple columns and multiple rows.

I want to loop through the DataTable dynamically basically the output should look as follows excluding

4条回答
  •  礼貌的吻别
    2021-02-07 04:18

         foreach (DataRow row in dt.Rows) 
         {
            foreach (DataColumn col in dt.Columns)
               Console.WriteLine(row[col]);
         }
    

提交回复
热议问题