COM Error when Connecting to SDE

Discussion created by kylaj on Aug 15, 2012
Latest reply on Aug 15, 2012 by kylaj
I just upgraded to 10.1 and I"m having issues connecting to an SDE geodatabase from a .NET platform. When I run the following code I get either a COM error or ArcMap just crashes.

Dim DA As IFeatureWorkspace = ArcSdeWorkspaceFromFile("C:\Users\kjacobsen\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\IEL-GIS_SQL.GDS\Griffiths.sde")

  Public Shared Function ArcSdeWorkspaceFromFile(ByVal connectionFile As String) As IWorkspace
            Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")
            Dim workspaceFactory As IWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)
            Return workspaceFactory.OpenFromFile(connectionFile, 0)
        End Function