Stonkie
Well-known member
- Joined
- Sep 12, 2007
- Messages
- 279
- Programming Experience
- 1-3
I have to build a pretty small Windows application with a list of items in a DataGridView (hidden "Id" column and displayed "Name" column). I can easily select those two columns and fill a DataTable with it to display on the DataGridView, but the actual table contain 20 000 records (in my stress tests, nominal number of records around 5 000 - 6 000) with 20 - 30 columns. It is impossible to select all the data from all the columns in memory as this takes too much memory for the current system constraints.
Now I also have a "Details" Form which must show informations about all those 20 - 30 columns along with some many to many relationships to other tables which must show a list of related entries (the Color table contains the colors with Id and Name and a secondary table contains the MainItemId and ColorId foreign keys). This detailled form only shows a single record at a time, but can be opened multiple times with different records and both allow the user to modify the information (if both have the same file open, the concurrency problems can be detected on the server and the user will just have to know someone has already modified the record, that someone being himself).
In short, this is a complete database with lots of tables, relationships and records. The database is on Sql Server 2005 and the system must support optimistic concurrency. I use VS2005 and .NET 2.0 and the application must be production quality (sending patches is by CD, expensive and people just never install them anyway). And as usual, it was late before it began...
--
My question is how should I work through this?
Should I use a simple query and DataTable to show in the DataGridView, then use a strongly typed dataset to contain the item information and its associated data from other tables. This approach forces me to use counters of which records are in use so I can remove them from the DataSet when they are not used which in turn may lead to memory leaks, especially if I use data binding on DataViews of the DataTables (because delegates can keep a complete object alive).
Or should I use a Strongly Typed DataSet just for the easy access to the data and pass a custom data holder for my data so I may keep the DataSet effectively empty (using only GetData instead of Fills to the DataSet), but I am forced to code an "IsModified" property and some sort of optimistic concurrency check (possibly modification counters in the database). I would then have to manually call a few update/insert/delete methods from my TableAdapters, but I think I can go through this without using any SQL (except from within the DataSet Designer obviously).
A quick and dirty solution would be to keep only modification counters on the main table and delete and reinsert any information from the secondary tables (for the current main record, not all the table...) to avoid keeping counters on those tables too...
At the moment, I think the second option is more viable, but maybe someone has a better idea or some argument I am unaware of... I am quite knowledgeable, but I need something to feed the though process...
Now I also have a "Details" Form which must show informations about all those 20 - 30 columns along with some many to many relationships to other tables which must show a list of related entries (the Color table contains the colors with Id and Name and a secondary table contains the MainItemId and ColorId foreign keys). This detailled form only shows a single record at a time, but can be opened multiple times with different records and both allow the user to modify the information (if both have the same file open, the concurrency problems can be detected on the server and the user will just have to know someone has already modified the record, that someone being himself).
In short, this is a complete database with lots of tables, relationships and records. The database is on Sql Server 2005 and the system must support optimistic concurrency. I use VS2005 and .NET 2.0 and the application must be production quality (sending patches is by CD, expensive and people just never install them anyway). And as usual, it was late before it began...
--
My question is how should I work through this?
Should I use a simple query and DataTable to show in the DataGridView, then use a strongly typed dataset to contain the item information and its associated data from other tables. This approach forces me to use counters of which records are in use so I can remove them from the DataSet when they are not used which in turn may lead to memory leaks, especially if I use data binding on DataViews of the DataTables (because delegates can keep a complete object alive).
Or should I use a Strongly Typed DataSet just for the easy access to the data and pass a custom data holder for my data so I may keep the DataSet effectively empty (using only GetData instead of Fills to the DataSet), but I am forced to code an "IsModified" property and some sort of optimistic concurrency check (possibly modification counters in the database). I would then have to manually call a few update/insert/delete methods from my TableAdapters, but I think I can go through this without using any SQL (except from within the DataSet Designer obviously).
A quick and dirty solution would be to keep only modification counters on the main table and delete and reinsert any information from the secondary tables (for the current main record, not all the table...) to avoid keeping counters on those tables too...
At the moment, I think the second option is more viable, but maybe someone has a better idea or some argument I am unaware of... I am quite knowledgeable, but I need something to feed the though process...