private void frmConfig_Load(object sender, EventArgs e) { if (flag_readonly) //只讀 { txt_Servername.ReadOnly = true; txt_database.ReadOnly = true; txt_loginid.ReadOnly = true; txt_password.ReadOnly = true; btn_test.Enabled = false; btn_test.Visible = false; btn_save.Enabled = false; btn_save.Visible = false; string sqlstring = DBUtility.GetAppConfig("myConnectionString"); sqlstring = DBUtility.Decrypt(sqlstring); sqlstring = sqlstring.Replace(" ", "");//去掉空格 sqlstring = sqlstring.ToUpper(); txt_Servername.Text = GetConString(sqlstring, "SERVER=", 7); txt_database.Text = GetConString(sqlstring, "DATABASE=", 9); txt_loginid.Text = GetConString(sqlstring, "UID=", 4); txt_password.Text = GetConString(sqlstring, "PWD=", 4); } else { txt_Servername.ReadOnly = false; txt_database.ReadOnly = false; txt_loginid.ReadOnly = false; txt_password.ReadOnly = false; btn_test.Enabled = true; btn_test.Visible = true; btn_save.Enabled = true; btn_save.Visible = true; } }