This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > DataSourcesOleDB > ESRI.ArcGIS.DataSourcesOleDB > Interfaces > IF > IFDOToADOConnection Interface > IFDOToADOConnection.Connect Method (ArcObjects .NET 10.4 SDK) |
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
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);
IFDOToADOConnection Interface | IWorkspace Interface | IWorkspaceFactory Interface