代码如下,目的是创建链接Oracle数据的Sqlworkspace对象,
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");
IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
// Create the connection properties.
IPropertySet connectionProps = new PropertySetClass();
connectionProps.SetProperty("dbclient", "Oracle11g");
connectionProps.SetProperty("serverinstance", "MyServer");
connectionProps.SetProperty("authentication_mode", "DBMS");
connectionProps.SetProperty("user", "MyLogin");
connectionProps.SetProperty("password", "MyPassword");
// Open the workspace.
IWorkspace workspace = workspaceFactory.Open(connectionProps, 0);
报错:无法链接其他主机上的Oracle数据库。
原因:("dbclient", "Oracle11g"); 设置参数不能为大写,正确为("dbclient", "oracle11g");