I saw lots of articles talking about 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
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.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