Hi,
I've recently returned to VB.net and a lot has changed and I'm looking for someone to explain if it is possible to have multiple commands for a single connection? For example:
Public cn as SqlClient.SqlConnectoin
Public Sub Test()
dim SqlCommand as SqlClient.SqlCommand
cn = New SqlClient.SqlConnection(My Login Info)
SqlCommand = New SqlClient.SqlCommand("Select count(*) from tblCustomers")
SqlCommand.Connection.Open
SqlCommand.ExecuteScalar
....
Is there a way that I can reuse the same cn for another select/insert/update/delete without having to .Close and then .Open again? Is there no way to just change the SqlCommand and Execute Scalar/NonQuery?
Basically I plan on executing multiple statements all the time and I'm trying to be sure I'm doing this the most efficient way.
Thanks,
iaw
I've recently returned to VB.net and a lot has changed and I'm looking for someone to explain if it is possible to have multiple commands for a single connection? For example:
Public cn as SqlClient.SqlConnectoin
Public Sub Test()
dim SqlCommand as SqlClient.SqlCommand
cn = New SqlClient.SqlConnection(My Login Info)
SqlCommand = New SqlClient.SqlCommand("Select count(*) from tblCustomers")
SqlCommand.Connection.Open
SqlCommand.ExecuteScalar
....
Is there a way that I can reuse the same cn for another select/insert/update/delete without having to .Close and then .Open again? Is there no way to just change the SqlCommand and Execute Scalar/NonQuery?
Basically I plan on executing multiple statements all the time and I'm trying to be sure I'm doing this the most efficient way.
Thanks,
iaw