Upload CSV file to SQL server

前端 未结 8 2083
悲哀的现实
悲哀的现实 2020-12-02 09:29

What is the best way to upload a large csv data file into SQL server using C# ? The file contains about 30,000 rows and 25 columns.

8条回答
  •  旧时难觅i
    2020-12-02 10:12

    Use System.Data.SqlClient.SqlBulkCopy class to insert data into Sql tables. To use that class you also need to convert CVS data to DataTable, see here one of the ways.

提交回复
热议问题