IWorkSpace接口介绍 1.打开各种数据库
IWorkspace接口提供访问工作空间的通用属性和方法,如它的连接属性,以及包含的数据集的方法。
IWorkspace的成员字段:
Members
Description |
|
The connection properties of the workspace. |
|
The DatasetNames in the workspace. |
|
The datasets in the workspace. |
|
Executes the specified SQL statement. |
|
Checks if the workspace exists. |
|
TRUE if the workspace is a file system directory. |
|
The file system full path of the workspace. |
|
The Type of the Workspace. |
|
The factory that created the workspace. |
如何打开一个数据库
要打开一个数据库,也就意味着我们要得到那个工作空间,而工作空间是一个普通类,也就意味着我们只
能从其他类来得到这个工作空间,这个类就是工作空间工厂(WorkspaceFactory),而这个类又是一个抽
象类,也就意味着我们只能使用它的子类来实例化一个对象,WorkspaceFactory有众多的子类
IWorkSpaceFactory是Geodatabase的入口,它定义了数据库的通用属性,比如打开,创建等,我们在ArcGIS Engine的帮助中可以详细的得到它的信息,如下图:
Members
Description |
||
Indicates if parentDirectory contains a valid workspace, or is a valid file-system workspace. |
||
Copies a workspace to the specified destination folder. |
||
Creates a new workspace specified by the directory, file name, and connection properties. |
||
The class ID of the WorkspaceFactory. |
||
Retrieves the workspace name of a workspace from the given list of file names. |
||
True if the specified file identifies a workspace supported by the workspace factory. |
||
Moves a workspace to the specified destination folder. |
||
Opens the workspace specified by the connection properties. |
||
Opens the workspace specified by the given file name. |
||
The connection properties from the specified file. |
||
A singular or plural description of the type of workspace the workspace factory opens/creates. |
||
The type of workspace the workspace factory opens/creates. |
打开数据库有两种方式,从上面的图表中也可以看出OpenFromFile方法和Open方法,这两者的区
方法中的参数不同,其中Open方法需要一个IPropertySet对象,这个方法我们经常在打开SDE数
使用,注意(这个方法同样可以用来打开个人数据库,文件数据库)。
打开个人数据库
public IWorkspace GetMDBWorkspace(String _pGDBName)
{
IWorkspaceFactory pWsFac = new AccessWorkspaceFactoryClass();
IWorkspace pWs = pWsFac.OpenFromFile(_pGDBName,0);
return pWs;
}
}
打开文件数据库
public IWorkspace GetFGDBWorkspace(String _pGDBName)
{
IWorkspaceFactory pWsFac = new FileGDBWorkspaceFactoryClass();
IWorkspace pWs = pWsFac.OpenFromFile(_pGDBName, 0);
return pWs;
}
打开SDE数据库
打开SDE数据库我们使用的是Open方法,要用这个方法,我们就要对IPropertySet对象设置,要打开SDE
数据库,我们要获取SDE数据库的服务器地址,数据库实例,数据库,用户,密码等参数。而IPropertySet
就好比一个Key-Value的对象,用来帮组我们设置这些,然后传到Open方法中。
public IWorkspace GetSDEWorkspace(String _pServerIP, String _pInstance, String _pUser, String
_pPassword, String _pDatabase, String _pVersion)
{
ESRI.ArcGIS.esriSystem.IPropertySet pPropertySet = new
ESRI.ArcGIS.esriSystem.PropertySetClass();
pPropertySet.SetProperty("SERVER", _pServerIP);
pPropertySet.SetProperty("INSTANCE", _pInstance);
pPropertySet.SetProperty("DATABASE", _pDatabase);
pPropertySet.SetProperty("USER", _pUser);
pPropertySet.SetProperty("PASSWORD", _pPassword);
pPropertySet.SetProperty("VERSION", _pVersion);
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory;
workspaceFactory = (ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)new
ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
return workspaceFactory.Open(pPropertySet, 0);
}
IWorkSpace接口介绍 1.打开各种数据库的更多相关文章
- IWorkSpace接口介绍
IWorkspace接口提供访问工作空间的通用属性和方法,如它的连接属性,以及包含的数据集的方法. 如何打开一个数据库 要打开一个数据库,也就意味着我们要得到那个工作空间,而工作空间是一个普通类,也 ...
- 如何删除要素类 IFeatureWorkspace 接口介绍(1)
如何删除要素类 要想删除一个要素类,那么必须先得到这个,在得到这个要素类的时候,我们要学习一个新的接口IFeatureWorkspace. IFeatureWorkspace 接口介绍 这个接口主要 ...
- ArcEngine打开本地数据库
先看一下GeoDatabase核心结构模型图: 1 工作空间工厂WorkspaceFactory对象 WorkspaceFactory是GeoDatabase的入口,是一个抽象类,拥有很多子类,例如 ...
- Hive 接口介绍(Web UI/JDBC)
Hive 接口介绍(Web UI/JDBC) 实验简介 本次实验学习 Hive 的两种接口:Web UI 以及 JDBC. 一.实验环境说明 1. 环境登录 无需密码自动登录,系统用户名shiyanl ...
- 通过ODBC接口访问人大金仓数据库
国产化软件和国产化芯片的窘境一样,一方面市场已经存在性能优越的同类软件,成本很低,但小众的国产化软件不仅需要高价买入版权,并且软件开发维护成本高:另一方面,国产软件目前普遍难用,性能不稳定,Bug ...
- SSH动态查询封装接口介绍
SSH动态查询封装接口介绍 1.查询记录总条数 public int count(Class c,Object[][] eq,Object[][] like,String[] group,String ...
- 【百度地图API】如何在地图上添加标注?——另有:坐标拾取工具+打车费用接口介绍
原文:[百度地图API]如何在地图上添加标注?--另有:坐标拾取工具+打车费用接口介绍 摘要: 在这篇文章中,你将学会,如何利用百度地图API进行标注.如何使用API新增的打车费用接口. ------ ...
- Redis --> Redis的接口介绍及使用
Redis的接口介绍及使用 Redis是一个远程内存数据库,它不仅性能强劲,而且还具有复制特性以及为解决问题而生的独一无二的数据模型.Redis提供了5种不同类型的数据结构,各式各样的问题都可以很自然 ...
- go语言之进阶篇文件常用操作接口介绍和使用
一.文件常用操作接口介绍 1.创建文件 法1: 推荐用法 func Create(name string) (file *File, err Error) 根据提供的文件名创建新的文件,返回一个文件对 ...
随机推荐
- Lotto
Lotto Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Submiss ...
- implement a system call in minix
http://www.papervisions.com/implementing-system-call-in-minix-os/
- Shell脚本,自动化发布tomcat项目【转载】
Shell脚本,自动化发布tomcat项目脚本. 1. vko2c_auto_build_by_scp.sh 文件内容: #---------------------start------------ ...
- 设置标题小图标ico
在head里添加 <link rel="shortcut icon" href="<%=request.getContextPath()%>/FlatU ...
- PHP的抽象类、接口类的区别和选择【转载】
本文转自:http://blog.csdn.net/fanteathy/article/details/7309966 区别: 1.对接口的使用是通过关键字implements.对抽象类的使用是通过关 ...
- JdbcTemplate学习笔记
JdbcTemplate学习笔记 1.使用JdbcTemplate的execute()方法执行SQL语句 Java 代码 jdbcTemplate.execute("CREATE TABLE ...
- js屏蔽浏览器右键菜单
<script type="text/javascript"> function doNothing(){ window.event.returnValue=false ...
- Anton and School
Anton and School time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- ACM课程学习总结
ACM课程学习总结报告 通过一个学期的ACM课程的学习,我学习了到了许多算法方面的知识,感受到了算法知识的精彩与博大,以及算法在解决问题时的巨大作用.此篇ACM课程学习总结报告将从以下方面展开: 学习 ...
- 转:WebDriver进行屏幕截图
例: 打开百度首页 ,进行截图 01 packagecom.example.tests; 02 importjava.io.File; 03 importorg.apache.commons.io ...