Creating a SQL Server table from a C# datatable

前端 未结 9 1075
死守一世寂寞
死守一世寂寞 2020-12-01 01:38

I have a DataTable that I manually created and loaded with data using C#.

What would be the most efficient way to create a table in SQL Server 2005 that uses the col

9条回答
  •  攒了一身酷
    2020-12-01 02:09

    If you mean from any arbitrary ADO.Net DataTable, I think you'd have to code that as a DDL 'code generation' tool, iterating through the DataTables' columns collection as you construct the "Create Table... " DDL Statement.

    Then connect to the desired database and execute the constructed Create Table DDL statement.

提交回复
热议问题