开发者

how to identify the login details from data base

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜