B
bannaman
Please can someone help.
I have a routine as follows
Public Function dbConnection() As SqlConnection
Dim dbConn As New SqlConnection
Dim errorH As New errorHandle
Try
Try
dbConn.ConnectionString =
ConfigurationManager.ConnectionStrings(globalapp.currentSite).ConnectionString.ToString
Catch ex As Exception
errorH.move(ex)
End Try
If dbConn.State = ConnectionState.Closed Then
dbConn.Open()
End If
Catch ex As SqlException
errorH.move(ex)
End Try
Return dbConn
End Function
This creates my sqlconnection. I call this from other functions in my
class in this format
Try
dim sqlconn as sqlconnection = dbconnection()
Catch ex as exception
Finally
If db.State = ConnectionState.Open Then
db.Close()
dbConnection.Dispose()
End If
End try
I recently only added the dbconnection.dispose because i read that i
should be doing that not sure if i should. But i'm getting the usual
error message of the maximum timeout has been reached or the maximum
pool size has been reached. I don't know what to do. Can anyone advise.
I have a routine as follows
Public Function dbConnection() As SqlConnection
Dim dbConn As New SqlConnection
Dim errorH As New errorHandle
Try
Try
dbConn.ConnectionString =
ConfigurationManager.ConnectionStrings(globalapp.currentSite).ConnectionString.ToString
Catch ex As Exception
errorH.move(ex)
End Try
If dbConn.State = ConnectionState.Closed Then
dbConn.Open()
End If
Catch ex As SqlException
errorH.move(ex)
End Try
Return dbConn
End Function
This creates my sqlconnection. I call this from other functions in my
class in this format
Try
dim sqlconn as sqlconnection = dbconnection()
Catch ex as exception
Finally
If db.State = ConnectionState.Open Then
db.Close()
dbConnection.Dispose()
End If
End try
I recently only added the dbconnection.dispose because i read that i
should be doing that not sure if i should. But i'm getting the usual
error message of the maximum timeout has been reached or the maximum
pool size has been reached. I don't know what to do. Can anyone advise.