Best way to Bulk Insert from a C# DataTable

后端 未结 5 666
轻奢々
轻奢々 2020-12-01 09:29

I have a DataTable that I want to push to the DB. I want to be able to say like

myDataTable.update();

But after reading the M

5条回答
  •  误落风尘
    2020-12-01 10:08

    This is going to be largely dependent on the RDBMS you're using, and whether a .NET option even exists for that RDBMS.

    If you're using SQL Server, use the SqlBulkCopy class.

    For other database vendors, try googling for them specifically. For example a search for ".NET Bulk insert into Oracle" turned up some interesting results, including this link back to Stack Overflow: Bulk Insert to Oracle using .NET.

提交回复
热议问题