Link to home
Create AccountLog in
Avatar of mainrotor
mainrotor

asked on

How do I check the state of my database connection in VB.Net

Hi Experts,
I have ad VB.Net program.  In my program I want to check the state of my SQL Server connection.  I use the following code to do so, but It gives me the following error:

name 'adstateopen' is not declared. it may be inaccessible


This is the code I am using:
            If cnConnect.State = adStateOpen Then
                cnConnect.Close()
            End If

Thanks in advance,
mrotor
ASKER CERTIFIED SOLUTION
Avatar of HugoHiasl
HugoHiasl

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer