Question What is the best way to save list items to the database

mutlyp

Member
Joined
Oct 11, 2012
Messages
8
Programming Experience
10+
I have a list(Of Strings) List. I need to save each item in the list to a table in a database.
I could Iterate through the list and save each item to the database. But if I have 10 items in the List then I have to do 10 calls to the database.


Is there a better way to do this so I don't have to make all those calls?

Is there a way I can do this with just one call to the database?

Thank you
 
Create a DataTable, populate it with all the data and then save it all in one go using a data adapter. Check this out:

Retrieving and Saving Data in Databases

The example you want is in post #3, but you should probably check out all the examples.
 
Back
Top