花时间从数据库中获取数据并填充datagridview [英] taking time to fetch the data from database and fill the datagridview

查看:93
本文介绍了花时间从数据库中获取数据并填充datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我写了一个单独的函数来从数据库中获取数据并填充datagridview。我在单独的线程中调用了该函数。我的数据集包含10个表,其中每个表包含大约15000-20000个记录,同时将数据表分配给datagridview,它花费了大约10-15秒的时间。任何人都可以帮助我吗?提前感谢........

Hi,
I wrote a seperate function to fetch the data from database and fill the datagridview. I called the function in seperate thread.My dataset contains 10 tables in which each table contains approximately 15000-20000 records,while assigning datatable to datagridview,it is taking too much time approximately 10-15 secs.can anyone help me?Thanks in advance........

推荐答案

RyanB31是对的,你需要看看为大量数据实现分页。

我建议阅读这个:

Paging KB文章 [ ^ ]只是为了给你一点想法,还有各种其他google结果详细说明怎么做分页。
RyanB31 is right, you need to look at implementing paging for large amounts of data.
I would suggest reading this:
Paging KB article[^] just to give you a bit of an idea, there are various other google results that detail how to do paging.


填充数据集,

让我们说,dset.tables [0]包含10000条记录。





在前端做分页概念(不为每一页和每一页提取数据库)

使用



dset .tables [0] .select(from range to torange)



返回datarow []。将行填入数据表并将数据表分配给datagridview。



datarow [] rows = dset.tables [0] .select(ColName> = 21 and ColName< ; = 30)



将从21 o 30重新列出所有列。
Fill the dataset,
let us say,dset.tables[0] contains 10000 records.


do paging concept in front end(without fetching the db for each and every next page)
using

dset.tables[0].select("from range to torange")

returns datarow[]. Fill the rows into datatable and assign datatable to datagridview.

datarow[] rows = dset.tables[0].select("ColName >=21 and ColName <=30")

will reurn all the columns from 21 o 30.


这篇关于花时间从数据库中获取数据并填充datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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