I have more than one data adapters in my form. Each data adapter has 4 data commands(insert, delete...).
How can I loop all the data comands in my form for setting some parameters?
I had try use a same parameter at both Update command and insert command in past,but the IDE show me a error that is the parameter is already use by another object.
you should be find a way about "dynamic create vb code" to resolve you problem.
Dim c as Control
for each c in Form1.Controls
If Typeof c is SqlDataAdapter then
'work with each type of command object individually
CType(c, SqlDataAdapter).SelectCommand.Parameters...
End If
next c
This will let you loop through all the data adapters quickly, assuming that the controls were added in form design mode. I don't know of any easy way to loop through each command object inside of each data adapter though.
Thanks huel, thanks 740520 (I hope is write!)
I'll try huel method. I have a lot of data adapters to a form and they recive the same parameter. That's way I need some kind of loop.
There is any container for this dataadapters? Or can I access the form component. Maybe this is the general ideea but I don't know how.
I'll post a result.
Thanks for the answer.
Have fun!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.