private void BTNlogin_Click(object sender, EventArgs e) { //ReadMyData(dbcommectionstring, "Login"); bool Login = sql.CheckLogin(conString, "Login", TBuser.Text, TBpassword.Text); if (Login == true) { FM_MainMenu mainmenu = new FM_MainMenu(); mainmenu.Show(); this.Owner = mainmenu; this.Hide(); } else { MessageBox.Show("Incorrect Username or Password"); } }
private void BTNlogin_Click(object sender, EventArgs e) { //ReadMyData(dbcommectionstring, "Login"); if (loginEmpty) { if (TBpassword.Text == tb_comfirmPass.Text && TBpassword.Text != "" && TBuser.Text != "") { sql.InsertNewUser(conString, "Login", TBuser.Text, TBpassword.Text); UpdateForm(); } else { if (TBuser.Text == "") { MessageBox.Show("User can not be empty", "Login"); } else if (TBpassword.Text == "") { MessageBox.Show("Password can not be empty", "Login"); } else { MessageBox.Show("Passwords do not match", "Login"); } TBpassword.Text = tb_comfirmPass.Text = ""; } } else { bool Login = sql.CheckLogin(conString, "Login", TBuser.Text, TBpassword.Text); if (Login == true) { SetUserInfo(); FM_MainMenu mainmenu = new FM_MainMenu(); mainmenu.Show(); this.Owner = mainmenu; this.Hide(); } else { MessageBox.Show("Incorrect Username or Password"); } } }