Say I have the following piece of code
Dim dtPerson As New DataTable
Dim cmd As New SqlClient.SqlCo mmand("sp_test" , database)
dtPerson.Load(c md.ExecuteReade r)
cmd.dispose()
which instanciates the command object, uses it then destroys it, now if i
rewrote it like this
Dim dtPerson As New DataTable
dtPerson.Load(N ew SqlClient.SqlCo mmand("test", database)
would that still act the same? because the commands scope is inside the load
method, shouldnt it be destroyed after the point of execution has passed the
load method? basicly creating a command that destroys itself after
execution? or is it better not to do it this way because that is not how it
works?
Dim dtPerson As New DataTable
Dim cmd As New SqlClient.SqlCo mmand("sp_test" , database)
dtPerson.Load(c md.ExecuteReade r)
cmd.dispose()
which instanciates the command object, uses it then destroys it, now if i
rewrote it like this
Dim dtPerson As New DataTable
dtPerson.Load(N ew SqlClient.SqlCo mmand("test", database)
would that still act the same? because the commands scope is inside the load
method, shouldnt it be destroyed after the point of execution has passed the
load method? basicly creating a command that destroys itself after
execution? or is it better not to do it this way because that is not how it
works?
Comment