1
Answer

login page

Photo of ancy chacko

ancy chacko

10y
913
1
Hi,
 am create a  Login Page . then i want to check roleid in the  logintable.
my code is..
MySqlCommand cmd = new MySqlCommand("select * from login where empcode =@empcode and password=@password ", cn);
       


        cmd.Parameters.AddWithValue("@empcode", txtempcode.Text);
        cmd.Parameters.AddWithValue("@password", txtpass.Text);
       MySqlDataAdapter da = new MySqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        da.Fill(dt);


        if (dt.Rows.Count > 0)
        {
            Response.Redirect("Home.aspx");
        }
        else
        {
            ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid Username and Password')</script>");
        }
    }
roleid is 1,2,3
using this roleid only i want to login....

Answers (1)