Datagrid性能VB.NET [英] Datagrid performance VB.NET

查看:230
本文介绍了Datagrid性能VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在VB.NET Aplication中从Sql server加载25000条记录到Gridview。

查询非常快但是当我绑定到Gridview时,需要30秒。

请帮我解决这个问题。

我看到其他使用Foxpro 8(旧版DBF)的应用程序可以在不到2秒的时间内将25,000个数据加载到gridview。



Don; t ask为什么我想一次加载数千个数据等等。我只是需要它。请给我技术解决方案。谢谢大家...



问候

Henry



我尝试了什么:



已经从datatable尝试数据绑定并且已经尝试手动添加datagridrow。

两者都不工作。

Hi,

I want to load 25000 records from Sql server to Gridview in VB.NET Aplication.
The query is very fast but when I bind to Gridview, it takes 30 seconds.
Please help me how to solve this problem.
I saw other applications using Foxpro 8 (old DBF) can load 25,000 data to gridview less than 2 seconds.

Don;t ask why I want to load thousands of data at once, etc, etc.. i just need it. Please give me technical solution of this. Thanks all...

Regards
Henry

What I have tried:

Already try databind from datatable and already try add datagridrow manually.
Both not working.

推荐答案

并非所有DataGrids的工作方式都相同。您在FoxPro中看到的内容与在VB.NET中显示表的控件的工作方式不同。 DataGrid和DataGridView控件的工作方式不同,并且比FoxPro网格做的更多。



你真的不能让网格显示25,000条记录而没有性能损失。你绝对需要实现分页。加载50条记录并绑定到网格。您可以让后台线程随着时间的推移不断加载越来越多的页面,或者您可以在滚动网格时加载其他记录。



Google for VB.NET DataGridView及时加载以获得更多讨论和示例。
Not all DataGrids work the same. What you saw in FoxPro does not work the same as a control that displays a table in VB.NET. The DataGrid and DataGridView controls work differently and do more than the FoxPro grid does.

You really can't have the grids show 25,000 records without a performance hit. You absolutely need to implement paging. Load 50 records and bind to the grid. You can either have a background thread keep loading more and more pages as time goes on or you can just load the additional records when the grid is scrolled.

Google for "VB.NET DataGridView just in time loading" for more discussions and examples on it.


每当你将那么多数据绑定到页面时它就会很慢,你无能为力关于那个。有更好的选择,但你似乎对它们不感兴趣所以你只需要忍受性能缓慢。
Whenever you bind that much data to the page it is going to be slow, there is nothing you can do about that. There are better alternatives but you don't seem interested in them so you're just going to have to put up with slow performance.




i know你说你为什么要加载25000行。但这是根本的!并且一些原生控件(.net)可能不太理想。



然而,我没有尝试,但你可以使用异步加载块。

用户是否能够同时显示25000行?

如果不是你可以做各种分页等...



抱歉,但你的解释有点模糊。



如果查询完成,在sql中返回25000行非常快。但并非所有控件都能够这样做。



我知道我的答案对你没有帮助,但可能你可以重写你的问题。

无论如何,数据表是最慢的可能的用途。你必须绑定到一个对象
Hi ,
i know you said "why do you want to load 25000" rows.But that is fundamental! and some of the native control (.net) might not be ideal.

however ,I didnt try but you could load in chunks using async.
Will the user be able to visualize 25000 rows at once?
if not you could do all sorts of pagination etc...

sorry but your explantion is a bit vague.

Returning 25000 rows in sql is very very fast if query done right.But not all controls are capable of doing that.

I know my answer does not help you but may be you could rework your question.
Anyway the datatable is the slowest you could possible use. you have to bind to an object


这篇关于Datagrid性能VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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