WPF:数据虚拟化 [英] WPF: Data Virtualization

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

问题描述

早上好。

我对WPF:数据这篇文章有疑问虚拟化。



我读了这篇文章,这对我的项目来说非常有趣且非常有用。

这是一个很棒的查看数据的方法。

我用它来读取我的数据库中的十九万个数据。

但有时,当我在GUI中读取这些数据时,我要读行,我得到一个错误说:



异常错误nell'UIThread

System.OurOfMemoryException



在出错之前,我意识到,通过GUI中的行计数器,

不会读取数据库中的所有数据,但是停止了大约三万七千行。

之后我用滚动条向下,然后出现错误信息。

什么可能导致这种错误?< br $> b $ b

我希望你能帮助我h一些建议

问候

Marco

Good morning.
I have a question about the article WPF: Data Virtualization .

I read the article and it was very interesting and very useful for my project.
It is a great way to view the data.
I am using it to read, one hundred and ninety thousand data from my database.
But sometimes, when I read this data inside my GUI, and I'm going to read rows, I get an error saying:

Exception error nell'UIThread
"System.OurOfMemoryException"

Before the error, I realized, through a line counter in the GUI,
that does not read all the data in the database, but stops about thirty-seven thousand lines.
After that when I go down with the scrollbar, then appears the error message.
What could cause this kind of error?

I hope u could help me with some advice
Regards
Marco

推荐答案

这是因为你使用的是低配置机器管理大量数据的能力。

而不是WPF中的UI端虚拟化,您可以使用SQL Server 2012中引入的OFFSET - FETCH关键字。

您也可以通过以下方式访问sql查询

在哪里可以通过选择特定的100,200或n数字来设置范围,这样你的应用程序就不会显示内存异常。

This is because you are using low configuration machine that donot have ability to manage your huge data.
Instead of Virtualization on UI side in WPF you can use OFFSET - FETCH keywords introduced in SQL Server 2012.
Your can also go by following sql query
Where you can make a range by selecting specific 100,200 or n numbers so that your application does not shows Out of Memory Exception.
SELECT
        ROW_NUMBER() OVER(ORDER BY Barcode) AS RowNumber, *
     FROM
        AllBarcode AS tbl
WHERE RowNumber>= @StartFrom AND RowNumber<= @EndNumber


这篇关于WPF:数据虚拟化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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