如何分页数据集 [英] How to paging for dataset

查看:110
本文介绍了如何分页数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,


我正在使用Oledbconnection,OleDataAdapter和数据集来访问Oracle数据库的数据。


我面对一个非常大的表(例如,超过10个记录,当我使用 


dataset.fill方法时,我得到了错误消息outofmemory。


如果我使用dataset.fill(startRecord,maxrecords,datatable)方法,我得到的错误为:


[System.Data.OleDb.OleDbException] = {" ORA-00936:小姐\\ nORA-00936:小姐"}



有人有任何想法吗?


谢谢。


Jeffers


解决方案

有人对此有任何想法吗?


是否停止使用数据集和数据表。您应该使用Oracle命令对象,P-SQL和Oracle数据处理器阅读查询结果,创建DTO,将DTO加载到列表< T>并返回列表< DTO>。 


W hy使用List< T>,一个集合?这是因为List使用的内存比数据表少6倍,并且集合使用速度比使用数据表更快,这也是一个额外的好处。


http://lauteikkehn.blogspot.com/2012/03/datatable-vs-list.html


https://dzone.com/articles/reasons-move-datatables


https://www.codeproject.com / Articles / 1050468 / Data-Transfer-Object-Design-Pattern-in-Csharp




Hi, Guys,

I am using Oledbconnection, OleDataAdapter and dataset to access the data of Oracle database.

And I am facing a very big table (for example, more than 10 mill records, when I use the 

dataset.fill method, I got the error message outofmemory.

If I used dataset.fill(startRecord, maxrecords, datatable) method, I got the error as:

[System.Data.OleDb.OleDbException] = {"ORA-00936: miss \r\nORA-00936: miss"}

Does somebody have any ideas on it?

Thanks.

Jeffers

解决方案

Does somebody have any ideas on it?

Yeah stop using a dataset and datatable. You should use Oracle command objects, P-SQL and Oracle datareader where you will read the results of the query,  creating a  DTO, loading the DTO into a List<T> and returning the List<DTO>. 

Why use the List<T>, a collection? It is because a List uses 6 times less memory than a datatable, and a collection usage is faster than using a datatable too as an additional benefit.

http://lauteikkehn.blogspot.com/2012/03/datatable-vs-list.html

https://dzone.com/articles/reasons-move-datatables

https://www.codeproject.com/Articles/1050468/Data-Transfer-Object-Design-Pattern-in-Csharp


这篇关于如何分页数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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