By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,361 Members | 3,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,361 IT Pros & Developers. It's quick & easy.

Too slow to use datagrid display records

P: n/a
I am trying to display some database records in datagrid using dataset.

the records need to be displayed are couple of thousands, but the records in
database that the SQL query needs to exam are more than 70 thousand, and it
is really slow to get the dataset ready to populate the datagrid.

I am sure there are solutions on this issue, but I just don't know :-(

Can anybody point me out any good solution to minimize the time used to
populate the datagrid?

Thanks a lot!

One thing I thought of is to make the datagrid starts to display records
simultaneously when data is filling into dataset. but I am not sure how to
achieve that.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Here are few articles that might help.
http://www.vb-tips.com/default.aspx?...6-fc0d5c470f53

http://www.vb-tips.com/default.aspx?...6-def86a1baeef

Ken
--------------------
"Kai Zhang" <ka*******@zeron.biz> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am trying to display some database records in datagrid using dataset.

the records need to be displayed are couple of thousands, but the records
in database that the SQL query needs to exam are more than 70 thousand,
and it is really slow to get the dataset ready to populate the datagrid.

I am sure there are solutions on this issue, but I just don't know :-(

Can anybody point me out any good solution to minimize the time used to
populate the datagrid?

Thanks a lot!

One thing I thought of is to make the datagrid starts to display records
simultaneously when data is filling into dataset. but I am not sure how to
achieve that.

Nov 21 '05 #2

P: n/a
Thanks for your reply, Ken.

for the first link:
http://www.vb-tips.com/default.aspx?...6-fc0d5c470f53
It allows user to know how much records have been loaded, and how long it
may take to finish loading the records, however, it does not allow user to
view the records quicker (unless update "Datagrid.DataSource" while
Datareader is reading records which may be very nasty, but I will have a
try).

for the second link:
http://www.vb-tips.com/default.aspx?...6-def86a1baeef
I am using the SQL 2000, so I cannot use this approach unless I implement
the NTile() by myself.

Nov 21 '05 #3

P: n/a
Hi Ken,
I did some changes to the sample code you suggested me to read on link:
http://www.vb-tips.com/default.aspx?...6-fc0d5c470f53

Here is my code:
...
dgbase.DataSource = table 'dgbase is the datagrid,
'table is a DataTable
which already has columns
While reader.Read 'reader is a SqlDataReader
Dim row As DataRow
row = table.NewRow()

Dim tempObject(table.Columns.Count - 1) As Object
reader.GetValues(tempObject)
row.ItemArray = tempObject

table.Rows.Add(row) 'Add new row to dgbase.DataSource
dgbase.Refresh() 'show the new added row
End While
...

The above code works fine, except all the controls on the form do not
respond to any interaction while the records is loaded into datagrid.

I know I can solve this by using a separate thread to run the above code,
and I am working on it. hopefully it will be OK.

Thanks again, Ken.
"Kai Zhang" <ka*******@zeron.biz> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
Thanks for your reply, Ken.

for the first link:
http://www.vb-tips.com/default.aspx?...6-fc0d5c470f53
It allows user to know how much records have been loaded, and how long it
may take to finish loading the records, however, it does not allow user to
view the records quicker (unless update "Datagrid.DataSource" while
Datareader is reading records which may be very nasty, but I will have a
try).

for the second link:

http://www.vb-tips.com/default.aspx?...6-def86a1baeef
I am using the SQL 2000, so I cannot use this approach unless I implement
the NTile() by myself.

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.