将数千条记录绑定到树节点 [英] Bind thousands of records to tree node

查看:92
本文介绍了将数千条记录绑定到树节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用mysql数据库.
我正在获取5000条记录并将这些记录绑定到树控件.
在那儿,我使用for循环,在该循环中,我将根节点绑定到树,然后从数据库中获取该根节点的子节点并绑定到树控件.

我正在使用存储过程而不是查询并为我的数据库表建立索引.

我想提高页面性能,因为加载记录需要太多时间(5000条记录需要30秒).

由于记录将在以后添加,因此会影响我的页面性能.

我该怎么办?

谢谢
sjs

Hi,

I am using mysql database.
I am fetching 5000 records and binding those records to a tree control.
In that, I use for loop where I am populating root node bind to tree and then fetching that root nodes child node from the database and binding to the tree control.

I am using stored procedure instead of queries and indexing to my database table.

I want to increase my page performance because it takes too much time (30 sec for 5000 records) to load the records.

As records will be added later so it will affect my page performance.

What Should I do?

Thanks
sjs

推荐答案

我过去做过这样的事情,有一些见解:

*在添加节点之前在TreeView上调用SuspendLayout,在
之后调用ResumeLayout 2.考虑如何获取数据-如果您一次又一次连接到数据库,则可能是一个问题.也许您可以在构建节点之前从完整数据中构建内部树表示.
3.考虑加载数据async(!)或"lazy",就像其他人告诉您的那样.
4.将相关数据缓存在节点标记中以备后用.
5.从UI角度来看,这么大的treenode不好用,也许您可​​以对其进行分类或将其拆分为较小的部分.如果根节点很少(用于拆分)且嵌套很深,则可以采用延迟加载.始终仅构建下一级别的节点,以便用户可以扩展节点(如果添加子节点,则会显示小加号)
6.如果此技巧无济于事,请显示一些代码,也许您还有其他性能问题?
I have done such things in the past, some insights:

* call SuspendLayout on the TreeView before adding nodes and ResumeLayout after
2. think about how you fetch the data - if you connect to the database again and again it could be a problem. Maybe you can build an internal tree representation out of the complete data before building the nodes.
3. think about loading the data async(!) or "lazy" as others told you.
4. cache the relevant data in the node tags for later use.
5. from an UI perspective such a big treenode is not nice, maybe you can categorize it or split it into smaller portions. If there are few root nodes (for splitting) and very deep nesting, lazy loading is the way to go. Always build just the next level of nodes, so the user can expand the node (the little plus sign is shown if you add child nodes)
6. If this tips does not help, show some code maybe you have some other performance problems?


药物指南计算机http://www.mahwey.com/-订购diazepam必须进行药理相互作用在与其他药物一起使用Valium时应引起注意. [url = http://www.mahwey.com/]便宜的在线价[/url]
Drug Guide Computer http://www.mahwey.com/ - order diazepam Pharmacological interactions must be given attention when prescribing Valium with other medications. [url=http://www.mahwey.com/]cheap valium online[/url]


这篇关于将数千条记录绑定到树节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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