ClsUserDAL user = new ClsUserDAL();
user.UserName = txtusername.Text;
user.Pass = txtpass.Text;
int x = user.check();
if (x == 0)
Label6.Text = "errors";
else if(x > 0)
Response.Redirect("Default.aspx");
hi for all i have this stored procedure in database
if @mode='check'
begin
select * from Users where UserName=@UserName and Pass=@Pass
end
and I have in BLL class this method
public static int checkBLL(ClsUserDAL obj)
{
string _spName1 = "usersPR"; // storedprocedure name
string _mode = "check"; // Method name in storedprocedure
DBBridge objDBBridge = new DBBridge();//
SqlParameter[] param = new SqlParameter[3];
param[0] = new SqlParameter("@Mode", _mode);
param[1] = new SqlParameter("@UserName", obj.UserName);
param[2] = new SqlParameter("@Pass", obj.Pass);
int x = objDBBridge.ExecuteNonQuery(_spName1, param);
return x;
}
and I have in DAL class this method
public int check()
{
return ClsUserBLL.checkBLL(this);
}
and in my login page inside login button I have this code
ClsUserDAL user = new ClsUserDAL();
user.UserName = txtusername.Text;
user.Pass = txtpass.Text;
int x = user.check();
if (x == 0)
Label6.Text = "errors";
else if(x > 0)
Response.Redirect("Default.aspx");
but the problem it doesn't work correctly any one can help me many thanks
mr.crazy
Member
34 Points
79 Posts
problem in login page code
May 26, 2012 07:14 AM|LINK
ClsUserDAL user = new ClsUserDAL(); user.UserName = txtusername.Text; user.Pass = txtpass.Text; int x = user.check(); if (x == 0) Label6.Text = "errors"; else if(x > 0) Response.Redirect("Default.aspx");hi for all i have this stored procedure in database
if @mode='check' begin select * from Users where UserName=@UserName and Pass=@Pass endand I have in BLL class this method
public static int checkBLL(ClsUserDAL obj) { string _spName1 = "usersPR"; // storedprocedure name string _mode = "check"; // Method name in storedprocedure DBBridge objDBBridge = new DBBridge();// SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@Mode", _mode); param[1] = new SqlParameter("@UserName", obj.UserName); param[2] = new SqlParameter("@Pass", obj.Pass); int x = objDBBridge.ExecuteNonQuery(_spName1, param); return x; }and I have in DAL class this method
public int check() { return ClsUserBLL.checkBLL(this); }and in my login page inside login button I have this code
ClsUserDAL user = new ClsUserDAL(); user.UserName = txtusername.Text; user.Pass = txtpass.Text; int x = user.check(); if (x == 0) Label6.Text = "errors"; else if(x > 0) Response.Redirect("Default.aspx");but the problem it doesn't work correctly any one can help me many thanks
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: problem in login page code
May 28, 2012 01:55 AM|LINK
Any exceptions?
What's that?
pierrefrc
Participant
947 Points
201 Posts
Re: problem in login page code
May 28, 2012 12:50 PM|LINK
Hi
In your Stored Procedure the size of the parameters is correct?
Example:
Pass is send from aspx with the size 10 and parameter in SP has the size 8?
In the table Users the password is encrypted? If is you need encrypted the pass using the same logic.
I hope this helps.