I have problem: i don't know how to check does connection to database is established.
I used:
Dim sqlConnection As SqlConnection = New SqlConnection(SQLconnectionEntry)
'SQLconnectionEntry is specified earlier
sqlConnection.Open()
after opening connection, i have to check is it established, but i stuck.
Any suggestions?
Thx.
EDIT:
Also, how to check does connection is NULL? Thx
EDIT:
I found an answer... simply:
Dim isOpen As Boolean If (sqlConnection.State = ConnectionState.Open) Then isOpen = True Else isOpen = False
And it works for me.
Hope that will help for others.
What about:
if (sqlConnection.State = ConnectionState.Open)Then
//Your Code here
End if
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With