Пример #1
0
        private void AddField_Load(object sender, EventArgs e)
        {
            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";//生成连接数据
            GeoDataCenterDbFun db       = new GeoDataCenterDbFun();
            string             strExp;

            if (m_flag == 1)//添加字段
            {
                comboBoxType.SelectedIndex = 0;
            }
            else//编辑字段
            {
                strExp = "select * from 图层命名初始化表 where 字段名称='" + m_fleldname + "'";
                DataTable dt = db.GetDataTableFromMdb(strCon, strExp);
                comBoxName.Text        = m_fleldname;
                textBoxDescribe.Text   = dt.Rows[0]["描述"].ToString();
                comboBoxType.Text      = dt.Rows[0]["字段类型"].ToString();
                textBoxLength.Text     = dt.Rows[0]["字段长度"].ToString();
                checkBoxChange.Checked = (bool)(dt.Rows[0]["可变"]);
                textBoxDefault.Text    = dt.Rows[0]["缺省"].ToString();
                id = Convert.ToInt32(dt.Rows[0]["ID"]);
            }
        }
Пример #2
0
        private void LoadListView()
        {
            listView.Items.Clear();
            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";//生成连接数据
            GeoDataCenterDbFun db       = new GeoDataCenterDbFun();
            //  string strExp = "select * from 图层命名初始化表 order by 排序";
            string    strExp = "select 字段名称,描述,字段类型,字段长度,缺省,排序 from 图层命名初始化表 order by 排序";
            DataTable dt     = db.GetDataTableFromMdb(strCon, strExp);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                listView.Items.Add(dt.Rows[i]["字段名称"].ToString());
                listView.Items[i].SubItems.Add(dt.Rows[i]["描述"].ToString());
                listView.Items[i].SubItems.Add(dt.Rows[i]["字段类型"].ToString());
                listView.Items[i].SubItems.Add(dt.Rows[i]["字段长度"].ToString());
                listView.Items[i].SubItems.Add(dt.Rows[i]["缺省"].ToString());
            }
        }
Пример #3
0
        private void comboBoxDsName_SelectedIndexChanged(object sender, EventArgs e)
        {
            GeoDataCenterDbFun db = new GeoDataCenterDbFun();

            if (comboBoxDsName.Text.Trim() == "")
            {
                cboDataType.Text     = "";
                txtUser.Text         = "";
                txtPassWord.Text     = "";
                txtServer.Text       =
                    txtDataBase.Text = "";
                return;
            }
            else
            {
                string    strExp = "select * from 物理数据源表 where 数据源名称='" + comboBoxDsName.Text + "'";
                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"; //生成连接数据库字符串
                DataTable dt     = db.GetDataTableFromMdb(strCon, strExp);
                if (dt.Rows.Count == 0)
                {
                    return;
                }
                //cboDataType.Text = dt.Rows[0]["数据源类型"].ToString();
                txtUser.Text             = dt.Rows[0]["用户"].ToString();
                txtPassWord.Text         = dt.Rows[0]["密码"].ToString();
                cboDataType.SelectedItem = dt.Rows[0]["数据源类型"];
                if (dt.Rows[0]["数据源类型"].Equals("SDE"))
                {
                    //SDE
                    txtServer.Text   = dt.Rows[0]["服务器"].ToString();
                    txtDataBase.Text = dt.Rows[0]["数据库"].ToString();
                }
                else
                {
                    txtServer.Text   = dt.Rows[0]["数据库"].ToString();
                    txtDataBase.Text = "";
                }
            }
        }