reading components form in vb net

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
 
S

Stoitcho Goutsev \(100\)

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.
 
R

roby9999

thank you very much Stoicho, your answer was very complete.
I will follow what you said,

Bye!

Roberto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top