private void MySqlOKBtn_Click(object sender, RoutedEventArgs e) { MySqlConnection connection = DBUtils.CreateMySqlConnection( server: MySqlHostTextBox.Text, username: MySqlUsernameTextBox.Text, password: MySqlPasswordTextBox.Password, noDB: true); try { connection.Open(); } catch (Exception ex) { MessageBox.Show("Connection failed with error: " + ex.Message); return; } connection.Close(); Properties.Settings.Default.mySqlHost = MySqlHostTextBox.Text; Properties.Settings.Default.mySqlUsername = MySqlUsernameTextBox.Text; Properties.Settings.Default.mySqlPassword = DBUtils.Protect(MySqlPasswordTextBox.Password); Properties.Settings.Default.databaseType = "MySql"; Properties.Settings.Default.Save(); Close(); }
private void MySqlTestConnectionBtn_Click(object sender, RoutedEventArgs e) { MySqlConnection connection = DBUtils.CreateMySqlConnection( server: MySqlHostTextBox.Text, username: MySqlUsernameTextBox.Text, password: MySqlPasswordTextBox.Password, noDB: true); try { connection.Open(); } catch (Exception ex) { MessageBox.Show("Connection failed with error: " + ex.Message); return; } MessageBox.Show("Connection succeeded."); connection.Close(); }