static public DataTable executeQuery(DatabaseName databaseName, String query) { DataTable dataTable = new DataTable(); MySqlConnection mySqlConnection = new MySqlConnection(SQLData.ConnStr(databaseName.ToString())); mySqlConnection.Open(); MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(query, mySqlConnection); mySqlDataAdapter.Fill(dataTable); mySqlConnection.Close(); return(dataTable); }
private void LoginButton_Click(object sender, EventArgs e) { try { updateData(); MySqlConnection mySqlConnection = new MySqlConnection(SQLData.ConnStr("net7")); mySqlConnection.Open(); mySqlConnection.Close(); this.Close(); } catch (MySqlException e1) { MessageBox.Show("N7 Login Encoutered a problem: \n\nBegin Message:\n" + e1.Message); } }
/// <summary> /// <para>Global form handler to catch the <enter> key and close the dialog</para> /// </summary> private void onEnterKey(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar.Equals('\r')) { try { updateData(); MySqlConnection mySqlConnection = new MySqlConnection(SQLData.ConnStr("net7")); mySqlConnection.Open(); mySqlConnection.Close(); this.Close(); } catch (MySqlException e1) { MessageBox.Show("N7 Login Encoutered a problem: \n\nBegin Message:\n" + e1.Message); } } }