Hi All,
What's the best way in asp.net mvc to take my array and save each element (and attaching a parentId to each as well) to my sql server db in one step?
thanks, rodchar
Hi All,
What's the best way in asp.net mvc to take my array and save each element (and attaching a parentId to each as well) to my sql server db in one step?
thanks, rodchar
Have a look at the SqlBulkCopy class. This allows you to bulk copy data into a table in a single call.
Typically, this is used to load data into a staging table, followed by a further call (usually to a stored procedure) which moves the data from the staging table to production table(s).
You may, however, choose to use it to append data directly to a production table.
The approach you choose will obviously be driven by how your database is engineered and the particular data you are loading.