C# - is there a way to stream a csv file into database?
I saw lots of articles talking abo开发者_如何学Gout using SqlBulkCopy to copy content from csv into database, but they all need to load the data into a data table or data set.
this is no good for me, since i deal with large amount of data, and i dont have powerful machine.
is there a way to stream data from the csv into database?
Thanks
This article does show how to load the data directly to the database, without using a temp data table/ data set.
C# - CSV Import Export
Just look for the moethod SaveToDatabaseDirectly
The simplest approach would probably be to read the CSV file line-by-line and execute an SQL INSERT
command to add the data to the appropriate table in the database.
精彩评论