This document is archived and information here might be outdated.  Recommended version.

IFDOToADOConnection.Connect Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > DataSourcesOLEDB > ESRI.ArcGIS.DataSourcesOleDB > Interfaces > IF > IFDOToADOConnection Interface > IFDOToADOConnection.Connect Method
ArcGIS Developer Help

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 _
public void Connect (
    IWorkspace pWorkspace,
    object pADOConnection
HRESULT Connect(
  IWorkspace* pWorkspace,
  LPUNKNOWN pADOConnection
pWorkspace [in]

pWorkspace is a parameter of type IWorkspace* pADOConnection [in]
pADOConnection is a parameter of type IUnknown

Product Availability

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


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.


// 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