code to check username and Password
You can do it in following way :
SqlDataAdapter objAdpt;SqlConnection objCon = new SqlConnectin("your database connection string");DataTable objDt;now in the Click event of Button say "OK" button click event..objAdpt = new SqlDataAdapter("Select * from yourtablename WHERE UserID=' " + textBox1.Text.Trim() + " ' , Password = ' " + textBox2.Text.Trim() + " ' ", objCon);objDt = new DataTable();objAdpt.Fill(objDt);if(objDt.Rows.Count > 0){lblmsg.Text="you are Login";- Response.Redirect("home.aspx");
// valid user. allow user to use system..}else{lblmsg.Text="Invalid Login";Response.Redirect("Login.aspx");// put message that invalid user..}
No comments:
Post a Comment