Winforms DataGrid with a 41,000+ records.

  • Thread starter Thread starter Aaron Smith
  • Start date Start date
A

Aaron Smith

I have a DataGrid (winforms) that is bound to a table (MSDE) that has
41,000+ records in it. The form loads relatively fast and I can scroll
all of the data... However, when I click in any column of any row other
than the first one, it takes forever to go to that row, even if it's
just the next one. So I limited the query to only a certain set of data
which returned a little less than a thousand records and the form shows
at the same speed, but when I click in a row, it passes for a few
seconds.. So I know it's an issue with the amount of data... If I can
see all the data on the grid, shouldn't it be just as fast to move from
row to row as it would if it only had a few records in it? Is there
something I need to do differently?

Aaron
 
Yes, you shouldn't be loading thousands of records. You are not supposed to
use the datatable as an in memory dataset. You are supposed to load the
data it needs into it, and have your grid display it.
 
Actually, I found the problem and it works fine now. Thanks anyway.
Yes, you shouldn't be loading thousands of records. You are not supposed to
use the datatable as an in memory dataset. You are supposed to load the
data it needs into it, and have your grid display it.
 
Heh. I didn't want to be embarassed.

When I originally wrote that form, we were working with the philosophy
of every time they move to a new row, we were going to save any changes,
and then update the grid in case someone else added or deleted entries.
Since then, the bosses decided that they would rather have people make a
bunch of changes, then click save to update the SQL Server tables. I
forgot to change the form before I imported the data, and to top it all
off, I wasn't checking for changes, I was just updating, then calling
fill of the dataadapter and resetting the datasource of the grid. So
every time you try to move or click in another row, it was running that
save and refresh routine. Nice huh? I spent over an hour trying to
figure out how to do some sort of paging routine when it was just me
being an idiot. Once I took that routine out, everything was fine.

It gets frustrating when you've only been doing stuff in ADO.Net for
about 3 weeks now and the last time I used regular ADO was about 4 years
ago. So half the time, everything I do is a shot in the dark. :P
 
Back
Top