First of all commands come in different flavours in .net.
But I would think every command needs an active connection.
You can set the connection in the constructor or use the .connection property of the command to set it later.
If you are using vs 2002/2003 than you can check out the constructors like so:
dim com as New SqlCommand(
After typing the ( you get the parameter(s) that can be passed to the constructor, when you use up and down arrow of your keyboard you can see the overloaded constructors.
here are the constructors for a sqlcommand:
Dim commm As New SqlCommand(commandText)
Dim commm As New SqlCommand(commandText, connection)
Dim commm As New SqlCommand(commandText, connection, transaction)
Dim commm As New SqlCommand()
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.