try this ...
public static IWorkspace CreateFileGdbWorkspace(String path)
{
// Instantiate a file geodatabase workspace factory and create a file geodatabase.
// The Create method returns a workspace name object.
Type factoryType = Type.GetTypeFromProgID(
"esriDataSourcesGDB.FileGDBWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance
(factoryType);
IWorkspaceName workspaceName = workspaceFactory.Create(path, "MyGDB.gdb", null,
0);
// Cast the workspace name object to the IName interface and open the workspace.
IName name = (IName)workspaceName;
IWorkspace workspace = (IWorkspace)name.Open();
return workspace;
}
Thanks and Regards,
Venkat
IWorkspaceFactory2 wsf = new FileGDBWorkspaceFactoryClass() as IWorkspaceFactory2; if (wsf.IsWorkspace(fileGdb)) { ws = wsf.OpenFromFile(fileGdb, 0); }
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.