Over five years, my application has been slowing down because one of the main tables has a lot of rows. It's still workable, but I'd like to rewrite how I handle data to make it more efficient before it becomes unworkable. I was new to vb.net five years ago, so I probably didn't do things in the best way.
For example, on a form that displays data from the large data table, I used the default TableAdapter. That of course loads the whole table into memory and then I filter to show the records that I want on the form. I know now that I could actually customize the query in the TableAdapter so that it only pulls the records that I want. I suspect that change alone would speed things up.
I'm also toying with the idea of writing the query myself and loading it into memory using the DataTable class and connecting it to the BindingSource.
Pros and cons of each?
The bigger issue is adding new records. There is a form in the program that allows the user to add data to the table. It doesn't display any data. It's only purpose is to allow data entry and save it to the database. Since the fields are connected to the database through a BindingSource and TableAdapter, the TableAdapter is loading all records from the table before going to the new record to allow data entry. This of course slows down the whole process.
It seemed fairly simple to just use an unbound form, validate the data that is entered, and take the data from the various fields and construct an INSERT query to add it to the database. But then the question became how to handle the data in the DataGridView, especially with a parent/child relationship. The functionality built into the TableAdapter to manage all of this works well, but if I'm using an unbound form then I have to do all of that.
What do people suggest?