Thanks for your response. I think I may have got it. I created a function myself. The script is below:
public static class Utilities
{
public static IFeatureWorkspace m_FeatureWorkspace =null;
private static IFeatureWorkspace m_ReadOnlyWorkspace = null;
private static string _path = "C:\\Users\\Me\\MyStuff\\MyProject\\myFile.sde";
public static IFeatureWorkspace connect()
{
IWorkspaceFactory _workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
m_ReadOnlyWorkspace = (IFeatureWorkspace)_workspaceFactory.OpenFromFile(_path, 1);
return m_ReadOnlyWorkspace;
}
}
I believe this to be correct and working. What do you think?I guess I would need to be sure, so I am also working on a conditional statement to "do something" or output a message whether I am actually connected to the sde file or not.