The sample below shows how to get source sde database type of layer.
It uses IDataLayer2 and IDatabaseConnectionInfo2 interface.
- IDataLayer2 : Provides access to additional members that control the data source properties of a layer.
- IDatabaseConnectionInfo2 : Provides access to members that provide information about the Workspace's connected database.
Private
Function getDBType(pLayer As ILayer) As String
Dim pDataLayer As IDataLayer2
Set pDataLayer = pLayer
Dim pDatasetName As IDatasetName
Set pDatasetName = pDataLayer.DataSourceName
Dim pWorkspaceName As IWorkspaceName
Set pWorkspaceName = pDatasetName.WorkspaceName
Dim pName As IName
Set pName = pWorkspaceName
Dim pWorkSpace As IWorkspace
Set pWorkSpace = pName.Open
Dim pDBConnInfo As IDatabaseConnectionInfo2
Set pDBConnInfo = pWorkSpace
Select Case pDBConnInfo.ConnectionDBMS
Case esriDBMS_Oracle
getDBType = "ORACLE"
Case esriDBMS_SQLServer
getDBType = "SQLSERVER"
Case esriDBMS_SQLServer
getDBType = "DB2"
Case esriDBMS_Unknown
getDBType = "UNKNOWN"
End Select
End Function
来自:http://www.cnblogs.com/iswszheng/archive/2009/05/15/1457324.html
本文介绍了一种方法,通过使用IDataLayer2和IDatabaseConnectionInfo2接口来获取地图图层的数据源类型,例如Oracle、SQL Server等。该方法适用于需要了解底层数据存储类型的GIS应用。
1442

被折叠的 条评论
为什么被折叠?



