예제 #1
0
파일: DBConnector.cs 프로젝트: 15831944/Apq
        // 刷新
        private void btnMySqlRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                btnMySqlRefresh.Enabled = false;
                MySqlUIEnable(false);
                cbMySqlDBName.Items.Clear();

                // 创建连接
                CreateMySqlConnection();

                // 获取数据库列表
                DataSet ds = new DataSet();
                Apq.Data.Common.DbConnectionHelper dch = new Data.Common.DbConnectionHelper(_MySqlConnection);
                DbDataAdapter dda = dch.CreateAdapter(@"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA");
                dda.Fill(ds);

                // 填充到下拉框选项
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    cbMySqlDBName.Items.Add(dr[0]);
                }
                btnMySqlRefresh.Enabled = true;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
            finally
            {
                MySqlUIEnable(true);
            }
        }
예제 #2
0
		// 刷新
		private void btnMySqlRefresh_Click(object sender, EventArgs e)
		{
			try
			{
				btnMySqlRefresh.Enabled = false;
				MySqlUIEnable(false);
				cbMySqlDBName.Items.Clear();

				// 创建连接
				CreateMySqlConnection();

				// 获取数据库列表
				DataSet ds = new DataSet();
				Apq.Data.Common.DbConnectionHelper dch = new Data.Common.DbConnectionHelper(_MySqlConnection);
				DbDataAdapter dda = dch.CreateAdapter(@"SELECT SCHEMA_NAME FROM information_schema.SCHEMATA");
				dda.Fill(ds);

				// 填充到下拉框选项
				foreach (DataRow dr in ds.Tables[0].Rows)
				{
					cbMySqlDBName.Items.Add(dr[0]);
				}
				btnMySqlRefresh.Enabled = true;
			}
			catch (System.Exception ex)
			{
				MessageBox.Show(this, ex.Message);
			}
			finally
			{
				MySqlUIEnable(true);
			}
		}