private void SetLogicDataSourceForm_Load(object sender, EventArgs e) { string mypath = m_dIndex.GetDbInfo(); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mypath + ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"; //生成连接数据库字符串 string strExp = "select 数据源名称 from 物理数据源表"; GeoDataCenterDbFun db = new GeoDataCenterDbFun(); List <string> list = db.GetDataReaderFromMdb(strCon, strExp); for (int i = 0; i < list.Count; i++) { comboBoxDsName.Items.Add(list[i]); } if (comboBoxDsName.Items.Count > 0) { comboBoxDsName.SelectedIndex = 0; } strExp = "select 行政代码 from 数据单元表"; list = new List <string>(); list = db.GetDataReaderFromMdb(strCon, strExp); for (int i = 0; i < list.Count; i++) { comboBoxAreaCode.Items.Add(list[i]); } if (comboBoxAreaCode.Items.Count > 0) { comboBoxAreaCode.SelectedIndex = 0; } }
//加载数据源名称 private void InitializeComDSname() { comboBoxDsName.Items.Clear(); string mypath = m_dIndex.GetDbInfo(); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mypath + ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"; //生成连接数据库字符串 string strExp = "select 数据源名称 from 物理数据源表"; GeoDataCenterDbFun db = new GeoDataCenterDbFun(); List <string> list = db.GetDataReaderFromMdb(strCon, strExp); for (int i = 0; i < list.Count; i++) { comboBoxDsName.Items.Add(list[i]); } if (comboBoxDsName.Items.Count > 0) { comboBoxDsName.SelectedIndex = 0; } }
private void InitComBoxName() { ComboBoxName.Items.Clear(); GetDataTreeInitIndex dIndex = new GetDataTreeInitIndex(); string path = dIndex.GetDbInfo(); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Mode=ReadWrite|Share Deny None;Persist Security Info=False";//生成连接数据库字符串 string strExp = "select 描述 from 标准图层信息表"; GeoDataCenterDbFun db = new GeoDataCenterDbFun(); List <string> list = db.GetDataReaderFromMdb(strCon, strExp); for (int i = 0; i < list.Count; i++) { ComboBoxName.Items.Add(list[i]); } if (list.Count > 0) { ComboBoxName.SelectedIndex = 0; } }