reading components form in vb net

  • Thread starter Thread starter roby9999
  • Start date Start date
R

roby9999

hello everyone,
i have a simple form in which there are 1 sqlconnection, some
sqldataadapter and 1 dataset.
During runtime i want to read all sqldataadapter to change all
SqlSelectCommand because my table defined at designtime is "TABLE", but
in runtime is "TABLE1" or "TABLE2", depending of a variable.

Is it possible to do this?
Thanks,


Roberto
 
Roby,

Unless you add all your dataadapters in a collection there us no way to
iterate them (at least not one that I know). SqlDataAdapter is a componet.
Some disposable components are implemented to go in the components
collection when added in design time, but SqlDataAdapter is not one of them.

The solution is really easy just keep a collection and when you create
dataadapter (or in the form constructor if you add them in design time) add
all the dataadapters to this collection. If you destroy some of them don't
forget to remove it from there.
 
thank you very much Stoicho, your answer was very complete.
I will follow what you said,

Bye!

Roberto
 
Back
Top