private void LoadConnection() { string strConn; strConn = cmbConnections.SelectedItem.ToString(); MySettingsSQLDwConnList ConnList = new MySettingsSQLDwConnList(strConn); ConnList.LoadConfigurationFile(); txtAzServer.Text = ConnList.ServerName; txtAzDatabase.Text = ConnList.DatabaseName; txtAzUser.Text = ConnList.UserID; //txtAzPassword.Text = UtilCryptor.Decrypt( ConnList.Password); txtAzPassword.Text = ConnList.Password; }
private void TestConnection() { string strConnString; string strServer, strUser, strPassword, strDatabase, strConn = ""; strServer = txtAzServer.Text; strUser = txtAzUser.Text; strPassword = txtAzPassword.Text; strDatabase = txtAzDatabase.Text; strConn = strServer + "." + strDatabase; strConnString = "Server=tcp:" + strServer + ";Database=" + strDatabase + ";Uid=" + strUser + ";Password="******"Connection successful"); MySettingsSQLDwConnList SQLDwList = new MySettingsSQLDwConnList(strConn); //strPassword = UtilCryptor.Crypt(strPassword); SQLDwList.SaveConnection(strServer, strDatabase, strUser, strPassword); this.btnNext.Enabled = true; this.AzConnString = strConnString; } catch { this.btnMigrate.Enabled = false; this.AzConnString = ""; UtilGeneral.ShowError("Error connecting to database"); } finally { conn.Close(); } }