ADO State Property

Definition and Usage

The State property can return a value that describes the current state of the object, whether it is open, closed, connecting, executing, or retrieving data. The value returned ObjectStateEnum Value. The default value is adStateClosed.

This property can be used for Command, Connection, Record, Recordset, and Stream objects.

The State property can be a combination of values. For example, if a statement is being executed, this property will have a combination value of adStateOpen and adStateExecuting.

The State property is read-only.

Syntax

object.State

Instance

For Command Object:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set comm=Server.CreateObject("ADODB.Command")
response.write(comm.State)
conn.close
%>

For Connection Object:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
response.write(conn.State)
conn.close
%>