Exemple #1
0
        /// <summary>
        /// 绑定源数据库和目标数据库
        /// </summary>
        public void Load()
        {
            DataTable dt_Source        = new DataTable();
            string    cmdString_Source = "select [DatabaseName] from Cfg_Bridge where IsSourceDb=1";

            dt_Source = SQLServerDBHelper.GetDataBaseName(cmdString_Source);
            if (dt_Source != null)
            {
                cbxSourceDataBases.DataSource    = dt_Source;
                cbxSourceDataBases.DisplayMember = "DatabaseName";
                txbResult.AppendText("源数据库绑定成功\r\n\r\n");
            }

            DataTable dt_Target        = new DataTable();
            string    cmdString_Target = "select [DatabaseName] from Cfg_Bridge where IsSourceDb=0";

            dt_Target = SQLServerDBHelper.GetDataBaseName(cmdString_Target);
            if (dt_Target != null)
            {
                cbxTargetDataBases.DataSource    = dt_Target;
                cbxTargetDataBases.DisplayMember = "DatabaseName";
                txbResult.AppendText("目标数据库绑定成功\r\n\r\n");
            }
            DataTable dt_DBName_DML        = new DataTable();
            string    cmdString_DBName_DML = "select tablename,comment from Cfg_TableNameForLoadData ";

            dt_DBName_DML = SQLServerDBHelper.GetDataBaseName(cmdString_DBName_DML);
            if (dt_DBName_DML != null)
            {
                DataGridViewCheckBoxColumn checkBox = new DataGridViewCheckBoxColumn();
                checkBox.HeaderText = "选择";
                dgv_DataBaseName.Columns.Insert(0, checkBox);
                dgv_DataBaseName.DataSource       = dt_DBName_DML;
                dgv_DataBaseName.Columns[0].Width = 40;
            }
        }