Code buttuon đăng nhập:
protected void btnDN_Click(object sender, EventArgs e)
{
string[] values = new string[]{
txtTK.Text,
txtMK.Text,
};
string[] pars = new string[]
{
"TEN_DANG_NHAP",
"MAT_KHAU"
};
DataSet ds = xl.docNhieuDLStored("dangNhap",values,pars);
if (ds.Tables[0].Rows.Count > 0) //Co du lieu dung trong CSDL
{
TaiKhoan tk = new TaiKhoan(
ds.Tables[0].Rows[0]["ID_TAI_KHOAN"] + ""
, ds.Tables[0].Rows[0][1] + ""
, ds.Tables[0].Rows[0][2] + ""
, ds.Tables[0].Rows[0][3] + ""
, ds.Tables[0].Rows[0][4] + "");
Session["dn"] = tk; //Ghi nhớ thông tin đăng nhập
if (ds.Tables[0].Rows[0][4] + "" == "1")
Response.Redirect("CapNhatLoaiHang.aspx");
else if (ds.Tables[0].Rows[0][4] + "" == "2")
Response.Redirect("mode.aspx");
else if (ds.Tables[0].Rows[0][4] + "" == "3")
Response.Redirect("cus.aspx");
}
}
Strored Procedure:
CREATE PROCEDURE [dbo].dangNhap
@TEN_DANG_NHAP VARCHAR (20),
@MAT_KHAU VARCHAR (128)
AS
SELECT * from TAI_KHOAN
where TEN_DANG_NHAP= @TEN_DANG_NHAP AND MAT_KHAU = @MAT_KHAU
Ai giúp em sửa lỗi làm form đăng nhập ASP.NET như thế này với ạ, em code mà nó không đặng nhập được ạ, e tìm trên mạng thì k có chỉ cách như thế này.