private void ButtonRegister_Click(object sender, RoutedEventArgs e) { MySqlHelper helper = new MySqlHelper(); try { string connectionString = "datasource=localhost; port=3306; username="******"; password="******"db_course_registration", "t_students", TextBoxMatNumber.Text.ToUpper(), TextBoxFirstName.Text.ToUpper(), TextBoxMiddleName.Text.ToUpper(), TextBoxLastName.Text.ToUpper(), TextBoxLevel.Text.ToUpper(), TextBoxID.Text.ToUpper()); } catch (Exception ex) { MessageBox.Show("Please enter a positive number"); return; } }
void Backup() { SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); sfd.Filter = "MySQL file (*.sql) | *.sql"; if (sfd.ShowDialog() == true) { try { Process process = new Process(); process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.FileName = "cmd.exe"; process.StartInfo.Arguments = "/C " + "mysqldump -u " + data.getUsername() + " -p" + data.getPassword() + " db_course_registration > " + sfd.FileName; process.Start(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public UserControlTable(LoginData data) { InitializeComponent(); this.data = data; connectionString = "datasource=localhost; port=3306; username="******"; password="******"db_course_registration"; tableName = "t_students"; db.LoadTable(DataGridStudents, connectionString, databaseName, tableName); }
private void fingerPrint_DoWork(object sender, DoWorkEventArgs e) { string rec; try { serial.Open(); do { rec = serial.ReadLine(); } while (rec.Length < 1); if (rec.Length > 0) { string pattern = @"\#\d"; Regex rgx = new Regex(pattern); MatchCollection mc = rgx.Matches(rec); id = Convert.ToInt32(mc[0].ToString().Replace("#", "")); } if (id != 0) { MySqlHelper helper = new MySqlHelper(); string connectionString = "datasource=localhost; port=3306; username="******"; password="******"db_course_registration", "t_students", id); fingerVerified = helper.IDConfirmed(connectionString, "db_course_registration", "t_students", matNumber, id); } }catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { serial.Close(); fingerPrint.CancelAsync(); } }
private void ButtonFindStudent_Click(object sender, RoutedEventArgs e) { MySqlHelper helper = new MySqlHelper(); string connectionString = "datasource=localhost; port=3306; username="******"; password="******"db_course_registration", "t_students", TextBoxMatNumber.Text); TextBoxName.IsEnabled = true; }
private void Button_Click(object sender, RoutedEventArgs e) { data.setUserName(TextBoxUserName.Text); data.setPassword(PasswordBoxPassword.Password); MySqlHelper helper = new MySqlHelper(); string connectionString = "datasource=localhost; port=3306; username="******"; password=" + data.getPassword(); bool successful = helper.TestConnection(connectionString); this.Visibility = successful ? Visibility.Collapsed : Visibility.Visible; }