3 aprilie 2012 05:25
I have to bind nearly 65,000 rows in DataGridView.
I have used the following coding
DataGridView1.DataSource = TempDataset.Tables(0)
It Takes too much time to load the data
How to improve this coding. I have load the data with in 1 min.
3 aprilie 2012 07:49
i doubt there is any faster way. What you can do, is to put this data "transfer" from dataTable to dgv on a new thread, and show progress, so user will see there is something going on.
I hope you dont do any other changes to dgv, like rows height or width changing, because this takes a lot of time to do all the calculation.
One question, how long does it take to get the data to dataTable from database?
3 aprilie 2012 08:05
i know that you won't like to read this, but getting 65000 rows in a grid is conceptually wrong!
There is NO real life scenario where a user is going to browse through 65000 records in an unstructured way to do his/her work.
when your user attacks the 65000 records, he/she will have a strategy to get to the records he/she wants.
Find out that strategy, and provide the tools so that the user can get to the (few) records he/she needs.
Most commonly, filters are provided, and result sets are returned in pages of lets say 20 records at a time.
3 aprilie 2012 10:06Nearly 4 to 5 min
3 aprilie 2012 10:07User should see all records and they need to edit require data
3 aprilie 2012 10:14
User should see all records and they need to edit require dataAh... oops, sorry I didn't realize
3 aprilie 2012 10:16
Loading 65000 records from DB and setting as DataSource to datagridview really slow. But there is a way smartly we can achieve through by setting VirtualMode to true. This is specially designed for larger dataset.
When CellValeNeeded event fires we need to provide the data that cell required. So build the mechanism so that,
1> Initially pull only few records - This depends upon number of records you show, you can think of having 300 - 400 records per batch.
2> On CellValueNeeded event fires, DataGridViewCellValueEventArgs provides for which row - column data required
3> So have a some sort of Cache , prefer objects than DataTable, behind that takes row index and column index and gives cell value.
4> On user scrolls down, once 400 rows crosses you need to get next batch of records
so that there is smooth scrolling and fast loading
There are some useful links shows how to implement using VirtualMode
I hope this helps you...
If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".
5 aprilie 2012 01:47ModeratorHi Alstroemeria,
I agree with Kris, when you want to display very large quantities of tabular data in a DataGridView control, you can set the VirtualMode property to true and explicitly manage the control's interaction with its data store. This lets you fine-tune the performance of the control in this situation.
If you still have any doubt and concern about this issue, please let us know.
Bob Wu [MSFT]
MSDN Community Support | Feedback to us
23 iulie 2012 07:24
there is scenario of getting 65,000 records in a grid .
I am using the data more than 65,000. I am also facing the problem. can you give me the solution for this??