private void addNewAccount_Click(object sender, EventArgs e) { // Creates new DBconnect instance dbConnect = new DBConnect(); // Invoking the class to create account dbConnect.createAccount(); }
private void testConnectionButton_Click(object sender, EventArgs e) { DBConnect db = new DBConnect(); if (db.OpenConnection()) { MessageBox.Show("It looks like it's working! Or is it...", "Connection Info"); } else { MessageBox.Show("Connection Problem."); } }
private void usernameFindTX_TextChanged(object sender, EventArgs e) { usernameListBox.Items.Clear(); DBConnect db = new DBConnect(); try { foreach (DataRow row in db.AQuery("SELECT accountName FROM account WHERE(accountName like \'" + usernameFindTX.Text + "%\')").Rows) { usernameListBox.Items.Add(row[0].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void createAccountButton_Click(object sender, EventArgs e) { if (usernameTX.Text != "" && passwordTX.Text != "") { DBConnect db = new DBConnect(); try { db.SQuery("INSERT INTO account (accountName, password) VALUES ('" + usernameTX.Text + "', '" + passwordTX.Text + "')"); MessageBox.Show("Account '" + usernameTX.Text + "' has been created. Have fun!", "Yay!"); } catch (Exception ex) { MessageBox.Show("Error: " + ex, "Error"); } } }