pushing a datatable from memory into SQL server using ADO.NET
I have a datatable in mem开发者_Python百科ory that I got from a non SQL source.
What is the most elegant way, using ADO.NET to push it "as is into a new SQL (2005) server table?You'd need to do this as a series of steps. Firstly, creating the table via some dynamic SQL. Then you'd need to load the information from memory into the newly created table, potentially using a BULK INSERT
.
Or create the table on the SQL Server, read one row at a time, and add it to the table.
- CREATE TABLE based on the structure
- SQLBulkCopy it
精彩评论