<ADODB_Connection>.State

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > ADODB > ADODB Module Classes > ADODB_Connection > ADODB_Connection Properties >

<ADODB_Connection>.State

 

Description

 
Returns a value that describes if the object is open, closed, connecting, executing or retrieving data.

 

Syntax

 

n = <ADODB_Connection>.State

 

Returns

 

Number: Connection State.

 

Possible values:

Constant

Value

Description

%adStateClosed

0

The object is closed

%adStateOpen

1

The object is open

%adStateConnecting

2

The object is connecting

%adStateExecuting

4

The object is executing a command

%adStateFetching

8

The rows of the object are being retrieved

 

Parameters

 

Name

Type

Optional

Meaning





 

 

Remarks

 

The State property can have a combination of values. If a statement is executing, this property will have a combined value of %adStateOpen and %adStateExecuting

 

Restrictions

 

See also

 

Examples

 

String sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_SourcePath & "Biblio.mdb"

 

'---Declare a new pConnection variable and instantiate it in one line

Dim pConnection As New ADODB_CONNECTION '[(sConn)]

'---Set connection string

pConnection.ConnectionString = sConn

'---Open connection. Connection string is taken from ConnectionString property

pConnection.Open

 

If pConnection.State = %ADSTATEOPEN Then

  PrintL "-Connection is open-" In %CCOLOR_FLIGHTGREEN

Else

  PrintL "-It was not possible to open a connection-" In %CCOLOR_FLIGHTRED

End If