1 //Open the database (workspace) using the Iname method.2 Public voidGetworkspace_iname (stringWorkspacepath) {3ESRI. ArcGIS.Geodatabase.IWorkspaceName WSN =NewESRI. ArcGIS.Geodatabase.WorkspaceNameClass ();4Wsn. Workspacefactoryprogid ="esridatasourcesgdb.accessworkspacefactory";5Wsn. PathName =Workspacepath;6ESRI. ArcGIS.esriSystem.IName name =(ESRI. ArcGIS.esriSystem.IName) WSN;7ESRI. ArcGIS.Geodatabase.IWorkspace ws =(ESRI. ArcGIS.Geodatabase.IWorkspace) name. Open ();8 }9 Ten //Open the personal database. One Public voidMdbworkspace () { A stringFile =@"G:\doc\gis\1.400\data\pdb.mdb"; -ESRI. ArcGIS.Geodatabase.IWorkspaceFactory WSF =NewESRI. ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass (); -ESRI. ArcGIS.Geodatabase.IWorkspace ws = WSF. Openfromfile (file,0); the } - - //Open the file database. - Public voidFdbworkspace () { + stringFile =@"G:\doc\gis\1.400\data\gdb.gdb"; -ESRI. ArcGIS.Geodatabase.IWorkspaceFactory WSF =NewESRI. ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass (); +ESRI. ArcGIS.Geodatabase.IWorkspace ws = WSF. Openfromfile (file,0); A}
Geodatabase-Open Database (workspace)