How to save data from a DataGridView into database? c# winforms
I have this little application, and what it does is a user can add many deductions to a certain employee and save the record.
What I do in my coding is I pass all the va开发者_如何学Clues to a DataTable
and loop through each rows and execute a stored procedure that inserts the particular row with the column values. This happens until there are no rows to be inserted from the DataTable.
Is there any shortcut? I mean, can I insert the whole value of datatable in one call? I just thought that my current way of inserting data is very resource consuming because it always calls the stored procedure in the server as long as there are rows in the datatable.
Any work around or suggestions? I would be very thankful. I hope you understand me,. thanks in advance.
Please have a look at these links
http://www.a2zdotnet.com/View.aspx?Id=107
http://ask.sqlservercentral.com/questions/7282/how-to-send-the-datatable-from-cnet-to-sqlserver-2008
精彩评论