This is hopefully a fairly straightforward question.
I am building a generic search form in my application. This will allow the user to search for various records throughout the application.
The one thing I cannot seem to figure out is how to allow the declaration of the TableAdapter to change at run-time. Each part of the app will be passing a variable to the search form to specify which table should be loaded.
In the form class I have the following:
FRIEND WITHEVENTS tbaSearchData AS database.databaseTableAdapters.TableOneTableAdapter
This is great for TableOne. But, I have about a hundred tables that could be searched through.
To load the data I’m using a DataGridView and populating it via a private method.
Any help would be greatly appreciated.
Tableadapter is really meant for design time setup and doesn’t easily change at runtime. You may want to look into using a DataAdapter, like SqlDataAdapter, for these requests. These objects have lower overhead and aren’t as type specific as a tableadapter so making them at runtime is a decent solution.