数据集和数据表C#的替代方式 [英] Alternative way for data set and data table C#

查看:81
本文介绍了数据集和数据表C#的替代方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Windows应用程序,在这个应用程序中有一个文本框,你可以在其中编写查询然后将结果检索到数据网格视图,我通过数据集将数据填充到网格视图中,问题与这种方法是内存使用率非常高,例如从内存中检索大约200,000条记录大约需要600 MB。



我需要另一种方法来获取数据进入网格而不会影响SQL Management Studio等内存,因为数据没有被加载或缓存到内存中,所以不会受到检索数据量的影响。



我尝试过的事情:



我尝试使用数据阅读器,但由于我需要,它不是那么好的解决方案将数据绑定到数据集然后绑定到网格

I am writing a windows application, in this application there is a textbox in which you can write a query then retrieve the result to a data grid view, i fill the data into the grid view through a data set, the problem with this method is that memory usage is very high, for example retrieving about 200,000 records will take about 600 MB from memory.

I need another way that i can get the data into the grid without impacting the memory such as SQL Management studio which doesn't get affected by the amount of data retrieved because the data isn't being loaded or cached into the memory.

What I have tried:

I tried using data reader but it wasn't that great of a solution since i need to bind the data to a dataset then to a grid

推荐答案

甚至不要尝试获取那么多记录 - 这对每个人都没用,特别是对你的用户来说。 />
你觉得我多久了t将使用户浏览数据网格视图中的200,000行以查找他们感兴趣的数据?小时?天?周?

除此之外,每行平均大约3K字节,而且您不仅使用内存,而且还在PC和数据库系统之间使用了大量的带宽。



最多显示前100行:让用户过滤它们,分页,搜索它们。但是,甚至不要尝试将那么多数据加载到任何显示控件中!并且只能获取您实际需要的列。



您的应用程序将加速,并且变得更容易使用。
Don't even try to fetch that many records - it's useless to everyone, particularly your user.
How long do you think it is going to take the user to browse through 200,000 rows in a data grid view to find the data they are interested in? Hours? Days? Weeks?
Add to that that each row is averaging around 3K bytes, and you are not only using memory, you're using serious bandwidth between your PC and the database system.

Show the top 100 rows at most: let the user filter them, page them, search them. But don;t even try to load that much data into any display control! And only ever fetch the columns you actually need.

Your app will speed up, as well as becoming easier to use.


这篇关于数据集和数据表C#的替代方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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