English

Problem: Data Link Properties is erroneously called when using the OpenFromString method to create a new OleDB workspace

Description

The Data Link Properties dialog box is erroneously called when using the OpenFromString method on the IWorkspaceFactory2 interface, implemented on the OleDBWorkspaceFactory CoClass. The workspace object should be created using the parameters supplied in the connection string, and it should not require any additional input via the dialog box.

Cause

This is a known issue.

Solution or Workaround

Use the OpenFromFile or Open methods on the IWorkspaceFactory interface to open a new OleDB workspace. For example:

  • OpenFromFile method:

    Code:

    Dim sFile As String
    sFile = "C:\WINNT\Profiles\username\Application Data\ESRI\ArcCatalog\OLEDB Data.odc"

    Dim pWorkspaceFact As IWorkspaceFactory
    Set pWorkspaceFact = New OLEDBWorkspaceFactory

    Dim pWorkspace As IWorkspace
    Set pWorkspace = pWorkspaceFact.OpenFromFile(sFile, 0)

  • Open method:

    Code:

    Dim pPropset As IPropertySet
    Set pPropset = New PropertySet

    pPropset.SetProperty "CONNECTSTRING","Provider= MSDASQL.1;data source=Excel_wks"
    Dim pWorkspace As IWorkspace
    Dim pWorkspaceFact As IWorkspaceFactory

    Set pWorkspaceFact = New OLEDBWorkspaceFactory
    Set pWorkspace = pWorkspaceFact.Open(pPropset, 0)