Rob said:
Hi,
The code goes something like this.... I am opening, closing, disposing,
then opening, closing, disposing, again.... maybe as many as 10 times in a
row back to back.... could this be a problem ?
cnn = New SqlConnection(strConnection)
cnn.Open
Dim cmd as New SqlCommand
cmd = cnn.CreateCommand
' code to execute a stored proc
cmd.ExecuteNonQuery()
cnn.close()
cnn.Dispose()
cmd.Dispose()
cmd=nothing
cnn = New SqlConnection(strConnection)
cnn.Open
Dim cmd2 as New SqlCommand
cmd2 = cnn.CreateCommand
' code to execute a stored proc
cmd2.ExecuteNonQuery()
cnn.close()
cnn.Dispose()
cmd2.Dispose()
cmd2=nothing
Thanks !
I can't say that it is. What you need to do is go to SQL Server 2005 using
the Query Analyzer equivalent that can be used on SQL Server 2000 and use
the the SQL Server Stored Procedure utility (I can't think of the Store
Procedure name) that tells you the active user-id(s) that are accessing SQL
server.
If you run your program and use that SQL Server utility, and you you see the
user-id the application is using to access SQL Server more than one time,
then you have a problem. The user-id should be showing only once throughout
the running of said application.
If this is in-line code back to back as you say, then you open the
connection one time, you execute your SQL commands, close the connection and
dispose of the connection. One connection that stays open until you execute
all the commands and then close the connection.
You use the open and close method when in-line back to back code is not
being used, with SQL Server access being done in different areas of the
code, like in different subroutines being called, as an example with their
own code to access SQl Server.
..