使用C#asp.net批量插入gridview [英] Bulk insert with gridview using C# asp.net

查看:201
本文介绍了使用C#asp.net批量插入gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用复选框来选择gridview中的行。

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.

推荐答案

当您回发时,请全部阅读检查行并将数据放入 DataTable 中。然后,您可以使用 SqlBulkCopy 对象将 DataTable 推送到您的数据库表中。

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.

这篇关于使用C#asp.net批量插入gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆