vendredi 17 avril 2015

List(of T) vs DataTable to fill a DB

I have a windows forms application to automate certain tasks and one part is to fill a SQL Server table with large amounts of information (sometime is less to 10, but i see a situation with more than 1000 lines!)


Today i have a List(of T) to execute this task. "T" is a class with 8 strings parameters.


In the "Save" function i parse the List to construct a SQL Query to insert the information in one table.


But the process of inserting in the DB sometime take several seconds to complete. Its better to use a DataTable with the 8 string columns to store the data and use to fill the database? I appreciate other suggestions too.


best regards


Aucun commentaire:

Enregistrer un commentaire