DataColumn Name from DataRow (not DataTable)

后端 未结 4 1833
暗喜
暗喜 2020-12-30 18:23

I need to iterate the columnname and column datatype from a specific row. All of the examples I have seen have iterated an entire datatable. I want to pass a single row to a

4条回答
  •  北海茫月
    2020-12-30 19:07

    You would still need to go through the DataTable class. But you can do so using your DataRow instance by using the Table property.

    foreach (DataColumn c in dr.Table.Columns)  //loop through the columns. 
    {
        MessageBox.Show(c.ColumnName);
    }
    

提交回复
热议问题