Get a DataTable Columns DataType

前端 未结 5 1107
萌比男神i
萌比男神i 2021-01-31 14:49
DataTable dt = new DataTable();  
dt.Columns.Add(new DataColumn(gridColumn1, typeof(bool)));

I was expecting the result of the below line to include in

5条回答
  •  梦毁少年i
    2021-01-31 15:27

    You can get column type of DataTable with DataType attribute of datatable column like below:

    var type = dt.Columns[0].DataType

    dt : DataTable object.

    0 : DataTable column index.

    Hope It Helps

    Ty :)

提交回复
热议问题