Select to view content in your preferred language

Error message: workspaceFactory.OpenFromFile(connectionFile, 0)

599
1
06-21-2017 12:57 PM
JoseSanchez
Frequent Contributor

Hello everyone,

In ArcGIS 10.2 with VS 2012 the line:

workspaceFactory.OpenFromFile(connectionFile, 0)

returns the error  message:

"Error HRESULT E_FAIL has been returned from a call to a COM component."

Public Function ArcSdeWorkspaceFromFile(ByVal connectionFile As String) As IWorkspace

Try

 

Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")

Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)

Return workspaceFactory.OpenFromFile(connectionFile, 0)  ############## RETURNS  AN ERROR

Catch ex As Exception

Debug.writeline(ex.Message)

Return Nothing

 

End Try

End Function

0 Kudos
1 Reply
JoseSanchez
Frequent Contributor

' Add IIS account IIS_IUSRS to the folder where SDE Connection files are located in read only access

' Fodler is listed in <add key="connectionSDE" value="C:\SDEConn\MySDEGeodatabase.sde"/>

0 Kudos