Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SqlCommand cmd = new SqlCommand("select * signin where Username =@username and Password=@password", con);
cmd.Parameters.AddWithValue("@username", UserName.Text);
cmd.Parameters.AddWithValue("@password", Password.Text);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
Response.Redirect("Default.aspx");
}
else
{
ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid Username and Password')</script>");
}
Posted

That means there are no such controls exists on the page having ids as UserName and Password.

Please add them. If you already have them, then check their ids correctly.
 
Share this answer
 
your query is wrong.please write proper query.which is following.
select * from signin where Username =@username and Password=@password
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900