M
Mark A. Deal
I have a compiled class that contains two functions. One opens a database
connection and another closes the connection.
If I have a button on a form that calls OpenDatabase(ErrorMessage) and then
call CloseDatabase from the same class, am I operating on the same
connection?
'***************************************************************************
*
' Opens connection to the database *
'***************************************************************************
*
Public Function OpenDatabase(ByRef DBError As String) As Boolean
SW_Connection = New SqlClient.SqlConnection(ReadRegKey("ConnectionString"))
Try
SW_Connection.Open()
Catch ex As Exception
DBError = "An error occurred opening connection to database: " & ex.Message
Return (False)
End Try
Return (True)
End Function
'***************************************************************************
*
' Closes connection to the database *
'***************************************************************************
*
Public Function CloseDatabase() As Boolean
SW_Connection.Close()
End Function
--
Mark A. Deal
Document & Data Solutions, LLC
http://www.docsol.com
Time Matters AIC
HotDocs Certified Consultant
GhostFill Certified Consultant
connection and another closes the connection.
If I have a button on a form that calls OpenDatabase(ErrorMessage) and then
call CloseDatabase from the same class, am I operating on the same
connection?
'***************************************************************************
*
' Opens connection to the database *
'***************************************************************************
*
Public Function OpenDatabase(ByRef DBError As String) As Boolean
SW_Connection = New SqlClient.SqlConnection(ReadRegKey("ConnectionString"))
Try
SW_Connection.Open()
Catch ex As Exception
DBError = "An error occurred opening connection to database: " & ex.Message
Return (False)
End Try
Return (True)
End Function
'***************************************************************************
*
' Closes connection to the database *
'***************************************************************************
*
Public Function CloseDatabase() As Boolean
SW_Connection.Close()
End Function
--
Mark A. Deal
Document & Data Solutions, LLC
http://www.docsol.com
Time Matters AIC
HotDocs Certified Consultant
GhostFill Certified Consultant