private void simpleButton1_Click(object sender, EventArgs e) { SqlConnection connect = new SqlConnection(@"Data Source=HP\SQLEXPRESS;Initial Catalog=QLSieuThi;Integrated Security=True"); try { connect.Open(); string tk = txtDangNhap.Text.Trim(); string mk = txtPass.Text.Trim(); string sql = "Select * from User where (Username = N'" + tk + "')" + "And (Password = '******')"; SqlCommand sqlcm = new SqlCommand(sql, connect); SqlDataReader dt = sqlcm.ExecuteReader(); if (dt.Read() == true) { panel2.Controls.Clear(); FrMain fr = new FrMain(); fr.TopLevel = false; panel2.Controls.Add(fr); fr.Show(); } else { MessageBox.Show("Đăng nhập thất bại!"); } } catch (Exception ex) { MessageBox.Show("Lỗi đăng nhập!"); } }
private void metroTileItem2_Click(object sender, EventArgs e) { FrMain form = new FrMain(); form.yonghu = yonghu; form.Show(); }