private void comboBoxArea_Click(object sender, EventArgs e) { GeoDataCenterDbFun dbfun = new GeoDataCenterDbFun(); GetDataTreeInitIndex dIndex = new GetDataTreeInitIndex(); string mypath = dIndex.GetDbInfo(); string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mypath + ";Mode=ReadWrite|Share Deny None;Persist Security Info=False"; //生成连接数据库字符串 frmDataUnitTree frm = new frmDataUnitTree(); //初始化数据单元树窗体 frm.Location = new Point(this.Location.X + 45, this.Location.Y + 140); frm.flag = 2; frm.ShowDialog(); if (Node != null)//传回的Node不是NULL { if (Convert.ToInt32(Node.Tag) != 0) { string strExp = "select 行政代码 from 数据单元表 where 行政名称='" + Node.Text + "' and 数据单元级别='" + Node.Tag + "'"; string code = dbfun.GetInfoFromMdbByExp(strCon, strExp); comboBoxArea.Text = Node.Text + "(" + code + ")";//为数据单元box显示数据 } else { comboBoxArea.Text = Node.Text;//为数据单元box显示数据 } } }
//点击行政区域 private void comboBoxArea_Click(object sender, EventArgs e) { GeoDataCenterDbFun dbfun = new GeoDataCenterDbFun(); frmDataUnitTree frm = new frmDataUnitTree();//初始化数据单元树窗体 frm.Location = new Point(this.Location.X + 147, this.Location.Y + 80); frm.flag = 0; frm.ShowDialog(); if (Node != null)//传回的Node不是NULL { if (Convert.ToInt32(Node.Tag) != 0) { string strExp = "select 行政代码 from 数据单元表 where 行政名称='" + Node.Text + "' and 数据单元级别='" + Node.Tag + "'"; string code = dbfun.GetInfoFromMdbByExp(m_con, strExp); comboBoxArea.Text = Node.Text + "(" + code + ")";//为数据单元box显示数据 } } }