i created a signup page and enter those values in database. Now i want to create a login page and have to check the details from the data base, whether the user registered or not? H开发者_如何学编程ow can any one help me...please?
Any way i will give you a basic idea
protected void Login_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=SYSTEM1;Initial Catalog=master;Integrated Security=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
string sql;
sql = "select *from user1 where uname ='" + TextBox1.Text + "' and pwd = '" + TextBox2.Text + "'";
cmd.CommandText = sql;
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
Response.Redirect("User.aspx");
}
}
This is just an idea you can implement in more secure way
精彩评论