System.Data.SqlClient Namespace SqlConnection Class
Returns the current state of the connection.
Script |
[ ConnectionState variable = ] SqlConnection.State |
The property is read only with a default value of Closed.
The allowed state changes are:
- From Closed to Open, using the Open method of the connnection object.
- From Open to Closed, using either the Close method or the Dispose method of the connection object.
The following example shows the simplest way to retrieve and display the State property of the current connection.
"Connection State: " + myConn.State.ToString ( );
"Connection State: " + myConn.State.ToString ( ) |
|
C# |
VB |
Show me
SqlConnection Members