asp.net.ph

OleDbConnection.State Property

System.Data.OleDb Namespace   OleDbConnection Class


Returns the current state of the connection.

Syntax


Script [ ConnectionState variable = ] OleDbConnection.State

Property Value


variable Returns a bitwise combination of the ConnectionState values.

The property is read only with a default value of Closed.

Remarks

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.

NOTE: Calling the State property increases application overhead because each call results in a call to the OLE DB DBPROP_CONNECTIONSTATUS property for an open connection.

Example

The following example shows the simplest way to retrieve and display the State property of the current connection.

"Connection State: " + myConn.State.ToString ( );
  C# VB

 Show me 

See Also

OleDbConnection Members   StateChange Event Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph