private void button4_Click(object sender, EventArgs e) { FormTrangChu f = new FormTrangChu(); f.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { if (username.Text.Trim() == "") { MessageBox.Show("Vui lòng nhập username", "Báo lỗi đăng nhập", MessageBoxButtons.OK); username.Focus(); return; } Program.mlogin = username.Text; Program.password = txtpassword.Text; if (Program.KetNoi() == 0) { return; } MessageBox.Show("Đăng nhập thành công", "", MessageBoxButtons.OK); SqlDataReader myReader; Program.mchinhanh = tENKHOAComboBox.SelectedIndex; string strLenh = "exec SP_DANGNHAP '" + username.Text + "'"; myReader = Program.ExecSqlDataReader(strLenh); if (myReader == null) { return; } myReader.Read(); Program.username = myReader.GetString(0); if (Convert.IsDBNull(Program.username)) { MessageBox.Show("Login bạn nhập không hợp lệ để truy cập dữ liệu"); return; } Program.mHoten = myReader.GetString(1); Program.mGroup = myReader.GetString(2); Program.mloginDN = username.Text; Program.passwordDN = txtpassword.Text; myReader.Close(); Program.conn.Close(); FormTrangChu f = new FormTrangChu(); f.Show(); this.Hide(); }