如何使用c#将大型数据表拆分为asp.net中的多个数据表? [英] How to split a large datatable into multiple datatables in asp.net with c#?

查看:131
本文介绍了如何使用c#将大型数据表拆分为asp.net中的多个数据表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c#将大型数据表拆分为asp.net中的多个数据表?

在数据表中有大约4万条记录。在完全填充到数据表内存异常时会出现异常。所以想要处理在数据块中提取的批量数据。

解决方案

只需获取记录总数并确定要分割的页数。 />
现在每次提取时都将 pageSize pageNumber 作为参数传递给程序。



因为如果你不能一次获取,你就可以处理内存不足异常,因为你必须在使用前把它放在内存中。因此,仅在页面上检索数据。


参考



如何将数据从一个Datatable划分为两个独立的Datatable? [ ^ ]



http:// stackoverflow.com/questions/12740353/split-a-datatable-into-2-or-more-datatables-based-on-column-value [ ^ ]


我建​​议你阅读:教程25:通过大量数据有效地进行寻呼a [ ^ ]

How to split a large datatable into multiple datatables in asp.net with c#?
In datatable there are around 4 lakh records. On filling it fully to the datatable out of memory exception comes. So wants to process bulk data fetched in chunks of data.

解决方案

Just get the total number of records and decide in how many pages you want to divide it.
Now pass the pageSize and pageNumber as parameter to procedure each time you fetch.

Because if you will fetch at a time no way you can handle the out of memory exception because you have to put it in memory before use. So retrieve data page wise only.


Refer

How to divide the data from one Datatable to two separate Datatable?[^]

http://stackoverflow.com/questions/12740353/split-a-datatable-into-2-or-more-datatables-based-on-column-value[^]


I'd suggest to read this: Tutorial 25: Efficiently Paging Through Large Amounts of Data[^]


这篇关于如何使用c#将大型数据表拆分为asp.net中的多个数据表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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