Geodatabase - 打开数据库(工作空间)

 1 //使用IName方式打开数据库(工作空间).

 2 public void GetWorkspace_IName(string workspacePath) {

 3     ESRI.ArcGIS.Geodatabase.IWorkspaceName wsn = new ESRI.ArcGIS.Geodatabase.WorkspaceNameClass();

 4     wsn.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory";

 5     wsn.PathName = workspacePath;

 6     ESRI.ArcGIS.esriSystem.IName name = (ESRI.ArcGIS.esriSystem.IName)wsn;

 7     ESRI.ArcGIS.Geodatabase.IWorkspace ws = (ESRI.ArcGIS.Geodatabase.IWorkspace)name.Open();

 8 }

 9 

10 //打开个人数据库.

11 public void MDBWorkspace() {

12     string file = @"G:\doc\gis\1.400\data\pdb.mdb";

13     ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass();

14     ESRI.ArcGIS.Geodatabase.IWorkspace ws = wsf.OpenFromFile(file, 0);

15 }

16 

17 //打开文件数据库.

18 public void FDBWorkspace() {

19     string file = @"G:\doc\gis\1.400\data\gdb.gdb";

20     ESRI.ArcGIS.Geodatabase.IWorkspaceFactory wsf = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass();

21     ESRI.ArcGIS.Geodatabase.IWorkspace ws = wsf.OpenFromFile(file, 0);

22 }

 

你可能感兴趣的:(database)