ArcObjects Library Reference (DataSourcesOleDB)  

IFDOToADOConnection.Connect Method

Connects a Workspace object to an ADO connection object.

[Visual Basic .NET]
Public Sub Connect ( _
    ByVal pWorkspace As IWorkspace, _
    ByVal pADOConnection As Object _
)
[C#]
public void Connect (
    IWorkspace pWorkspace,
    object pADOConnection
);
[C++]
HRESULT Connect(
  IWorkspace* pWorkspace,
  LPUNKNOWN pADOConnection
);
[C++]

Parameters

pWorkspace [in]

  pWorkspace is a parameter of type IWorkspace

pADOConnection [in]   pADOConnection is a parameter of type LPUNKNOWN

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The Connect method connects a workspace object to an ADO (ActiveX Data Objects) connection object. The ADO connection object must exist BUT not be opened, before this method is called. If the ADO connection has any existing properties, they will be over-written.

[C#]

// Open an ADOConnection to an access workspace

IFDOToADOConnection fdoToadoConnection = new FdoAdoConnectionClass();
ADODB.Connection adoConnection = new ADODB.Connection();
fdoToadoConnection.Connect(workspace, adoConnection);

//Issue an ADO query against an access data source
ADODB.Recordset adoRecordSet = new ADODB.Recordset();
adoRecordSet.Open("Select * from us_states", adoConnection, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockOptimistic,0);

See Also

IFDOToADOConnection Interface | IWorkspace Interface | IWorkspaceFactory Interface