private void button1_Click(object sender, EventArgs e) { FormMenu fe = new FormMenu(); fe.Show(); this.Hide(); }
private void btn1_Click(object sender, EventArgs e) { String username = txt1.Text; String password = txt2.Text; String connectionString = "server = localhost; database = login; uid = root; pwd ='';"; MySqlConnection cnn = new MySqlConnection(connectionString); try { cnn.Open(); MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM dat_login WHERE username = '******' && password='******'", cnn); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count <= 0) { MessageBox.Show("Gagal Login!"); } else { FormMenu fr = new FormMenu(); fr.Show(); this.Hide(); } cnn.Close(); } catch (Exception ex) { MessageBox.Show("Koneksi Error"); } }