예제 #1
0
        /// <summary>
        /// 加载连接
        /// </summary>
        private void LoadConnection()
        {
            var dal      = new DbConnConfigDAL();
            var connList = dal.FindAll().ToList();

            cmbConnectionList.Items.Clear();
            foreach (var item in connList)
            {
                cmbConnectionList.Items.Add(item.Name);
            }

            var tmpIndex = connList.FindIndex(tmp => tmp.Name == nowConnectionName);

            if (tmpIndex >= 0)
            {
                cmbConnectionList.SelectedIndex = tmpIndex;
                LoadTable(connList[tmpIndex].Name);
            }
            else
            {
                //清理相关数据
                this.listBox1.Items.Clear();
                this.listBox2.Items.Clear();
                this.unSelectedTableList.Clear();
                this.selectedTableList.Clear();
            }
        }
예제 #2
0
        /// <summary>
        /// 刷新所有数据库配置
        /// </summary>
        private void RefreshDatabase()
        {
            cbConnectStringName.Items.Clear();

            var list = dal.FindAll().ToList();

            foreach (var item in list)
            {
                if (item.IsActive)
                {
                    cbConnectStringName.Items.Add(item.Name);
                }
            }
        }