Make a new DataTable with the same columns as another DataTable

前端 未结 2 1367

I want to create a new DataTable that has the same columns as another DataTable.

Currently, I do the following:

DataTable myTable = new DataTable();
         


        
相关标签:
2条回答
  • 2021-01-07 22:08

    Try to use

    myTable = table.Clone()
    
    0 讨论(0)
  • 2021-01-07 22:20

    Use the Clone method - it creates a copy of the schema (columns) only.
    See DataTable.Clone

    0 讨论(0)
提交回复
热议问题