Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable TableAdapter declaration

Status
Not open for further replies.

xiong

Programmer
Feb 13, 2003
93
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.



"Only the educated are free.
 
Im not sure if you've figured this out on your own or not (considering the question is a month old), but have you given thought to placing your table adapter in a procedure then when someone performs a search, you pass the required data as arguments then perform your search within the scope of the procedure.

Or for that matter, you could create a class for the table adapter and be able to keep it "alive" for additional searches until someone needs to search another table, then you kill the old one and create an new instantiation for the new table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top