使用Arcengine开发的程序连接sql server Express失败

使用Arcengine开发的程序连接sql server Express失败
已邀请:

蒋汪洋

赞同来自:

【问题分析】:
代码中缺少一些连接参数
【解决办法】:
详见代码
 // For example, for direct connect with OSA authentication. 
// DBConnProp = tivo_sqlexpress.
// Instance = sde:sqlserver:tivo\\sqlexpress.
// Database = sewer.
// Authentication_mode = OSA.
// Version = dbo.DEFAULT.
public static IWorkspace WorkgroupArcSdeWorkspaceFromPropertySet(String server, String instance,
String authenticationMode, String database, String version)
{
IPropertySet propertySet = new PropertySetClass(); propertySet.SetProperty(“INSTANCE'',Instance = sde:sqlserver:tivo\\sqlexpress.)
propertySet.SetProperty(DB_CONNECTION_PROPERTIES, DBConnProp);
propertySet.SetProperty(DATABASE, database);
propertySet.SetProperty(AUTHENTICATION_MODE, authenticationMode);
propertySet.SetProperty(VERSION, version);

Type factoryType = Type.GetTypeFromProgID(esriDataSourcesGDB.SdeWorkspaceFactory);
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
return workspaceFactory.Open(propertySet, 0);
}

要回复问题请先登录注册