private void BtnDangnhap_Click(object sender, EventArgs e) { //SqlConnection con = new SqlConnection(@ "Data Source=STL-4110;Initial Catalog=Practice;Integrated Security=True"); //SqlCommand cmd = new SqlCommand("select * from Userlogins where UserName=@UserName and Password =@Password", con); //cmd.Parameters.AddWithValue("@UserName", textBox1.Text); //cmd.Parameters.AddWithValue("@Password", textBox2.Text); //SqlDataAdapter sda = new SqlDataAdapter(cmd); //DataTable dt = new DataTable(); //sda.Fill(dt); //Connection open here //con.Open(); //int i = cmd.ExecuteNonQuery(); //con.Close(); //if (dt.Rows.Count > 0) //{ MessageBox.Show("Successfully loged in"); this.Hide(); //after successful it will redirect to next page . frmHomeQLDL settingsForm = new frmHomeQLDL(); settingsForm.Show(); //} //else //{ // MessageBox.Show("Please enter Correct Username and Password"); //} }
private void FrmQLHangTon_FormClosing(object sender, FormClosingEventArgs e) { frmHomeQLDL settingsForm = new frmHomeQLDL(); this.Hide(); settingsForm.Show(); }