AnsweredAssumed Answered

Error message: workspaceFactory.OpenFromFile(connectionFile, 0)

Question asked by jsn on Jun 21, 2017
Latest reply on Apr 25, 2018 by jsn

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

Outcomes