question about using connection

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hi,

i use this for a database connection:

Using mConnection As New SqlConnection(param.ConnectionString)
mConnection.Open()
sql = "insert ...."
comd = New SqlCommand(sql, mConnection)
comd.ExecuteNonQuery()
End Using

My question is: do i need to close the connection with: mConnection.Close()
or does the End Using do itself?

thanks
Eric
 
The end using statement closes it. If you don't use the using statement you
would have to close it yourself.
 
Back
Top