Jamal Kawar
Jamal Kawar

Reputation: 3

inserting huge ammount of rows into mysql useing C# from csv file

i need to insert data from csv files the dates strings ints code every file have about 28column and 6000 rows i need to insert the data of multiple file when clicking on a buttom i tryed to insert them row by row using the sql insert statment but it take around 2 mins to finish and sometimes crash i need some help to make the proccess faster and smooth i usually check if a row is inserted thus no rows with same data are inserted into the database any help would be appreciated

Upvotes: 0

Views: 215

Answers (1)

Jonathan Ford
Jonathan Ford

Reputation: 16

If there are a lot of duplicates in the files, you could load all rows into a list and use the Distinct method in System.Linq before inserting into the database. The type contained in the list would implement the IComparable interface.

Upvotes: 0

Related Questions