您好,请问您是用.net还是java呢?
.net的话,首先数据源集合是不能构造的,您只能通过创建新的工作空间的方式创建数据源集合;其次MapControl.Map下并没有Datasource属性,您要是想将整个数据源添加到地图中,您需要依次添加数据源中的数据集至地图中,即:
Workspace workspace1 = new Workspace();
DatasourceConnectionInfo info = new DatasourceConnectionInfo();
info.EngineType = EngineType.SQLPlus;
if (workspace1.Datasources.Open(info) != null)
{
Datasource datasource = workspace1.Datasources[info.Alias];
Datasource m_data = workspace1.Datasources.Open(info);
MapControl mc1 = new MapControl();
mc1.Map.Workspace = workspace1;
foreach (Dataset dataset in m_data.Datasets)
{
mc1.Map.Layers.Add(dataset, true);
}
}