Bulk insert with gridview using C# asp.net

旧城冷巷雨未停 提交于 2020-01-07 09:01:16

问题


I'm using checkbox to select the rows in the gridview. How do I insert the muliple selected rows into the table opening the connection for only one time.


回答1:


When you postback, read all the checked rows and put the data into a DataTable. You can then use a SqlBulkCopy object to push that DataTable into your database table.




回答2:


Using JS to write into hidden field when user (un)checks a checkbox or to perform ajax call to server with id checked row.



来源:https://stackoverflow.com/questions/4396018/bulk-insert-with-gridview-using-c-sharp-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!