When any user is login i show his/her name in upper right corner and in my application there is also a designations like manager,approve,director and i want when manager is login there is designation also display in upper right corner like this
john(manager)
i create sp like this
create procedure [dbo].[spdesiname]
@UserName nvarchar(50),
@Password nvarchar(50)
as
select Designation.DesigType from Userss inner join dbo.Designation on
dbo.Designation.DesigID=dbo.Userss.DesigID where UserName=@UserName and Password=@Password
select SCOPE_IDENTITY();
and create function like this
public int spdesignname(string UserName, string Password)
{
return Convert.ToInt32(db.ExecuteScalar("spdesiname", new object[] { UserName, Password }));
}
and then call this function like this
int desginid1 = Convert.ToInt16(aa.spdesignname(txt_username.Value, txt_pass.Value));
Session["UserDesignationName"] = desginid;
and then in master page i call session like this.
if ((Session["Login2"] != null) & (Session["UserDesignationName"] != null))
{
WELCOME.Text = Session["Login2"].ToString() + "(" + Convert.ToString(Session["UserDesignationName"]) + ")";
}
and then when i call this session in master page then it shows me incorrect password or username.
but i not works , How i done this ?
Please try with below code:
if your session id made from "Login2" + UserDesignationID