如何从具有分页的GridView保存大量数据以将5000条记录显示到mssql表 [英] how to save bulk data from gridview having paging to show 5000 records to mssql table

查看:61
本文介绍了如何从具有分页的GridView保存大量数据以将5000条记录显示到mssql表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

向大家问好
我的问题是我有2列和5000条记录的Excel文件,或者更多,我成功上传了excel文件并成功将其与gridview绑定,但是现在我的问题是必须将数据从gridview保存到数据库,但是它仅选择仅在Ist页面中显示的记录.因为在用gridview用户出价excel之后,还需要在gridview中输入一些其他信息.
如果有人对此问题有解决方案,请帮助我.
在此先感谢.
等待答复

hello to all
My problem is that i have an Excel file with 2 columns and 5000 records or may be more i uploaded the excel file successfully and bind it with the gridview successfully but now my problem is that is have to save that data from gridview to database but it picks only the records showing in Ist page only. as after biding the excel with gridview user also enter some other information that is required in gridview.
please help me if anyone has solution for this prob.
thanks in advance.
waiting for reply

推荐答案



使用datatable在保存扫描gridview上将数据与gridview绑定,然后使用批量上传将数据保存在数据库中.


Use datatable to bind data with gridview on save scan gridview & then use bulk upload to save data in database.


使用您的自定义类并将其设置为[Serializable]
然后从excel创建数据列表,或使用Datatable绑定网格还将其存储在viewstate中,并在回发时从viewstate检索您的集合或数据表.通过用户更改更新您的集合,将其恢复到viewstate中,然后最后使用OPENXML将其存储在数据库中. />
您可以尝试这篇文章以获得进一步的帮助

将类或对象列表的序列化成XML并使用OpenXML [ ^ ]
Use your custom class and make it [Serializable]
then create your list of data from excel or use Datatable bind grid also store it in in viewstate and retrieve your collection or datatable from viewstate on postback update your collection by user changes restore it in viewstate then finally store it in database using OPENXML.

you can try this article for further help

Serialized collection of classes or List of objects into XML and bulk insert using OpenXML[^]


使用表值参数保存来自gridview的批量数据.请参阅下面的文章链接:
将数据表发送到存储过程 [ ^ ]
C#和表值参数 [表值参数 [使用表值参数(数据库引擎) [
Use Table valued parameters to save bulk data from gridview. Refer the links below for an article:
Sending a DataTable to a Stored Procedure[^]
C# and Table Value Parameters[^]
Table-Valued Parameters[^]
Use Table-Valued Parameters (Database Engine)[^]


Hope it helps!
      --Amit


这篇关于如何从具有分页的GridView保存大量数据以将5000条记录显示到mssql表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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