0

Hi,

i have a user table in backend with many columns n from that i need to user the email id and password for login. I have read the data in my code using a data reader, but am not getting how to match the entered username and password by user with the backend data.
If any one can pls guide with same...
Thanks

protected void btnLogin_Click(object sender, EventArgs e)
    {
        //string cmd1 = ("Select email, password from fwm_user");
        //DataSet ds;
        //SqlDataAdapter da = new SqlDataAdapter(cmd1, conn1);
        //da.Fill(ds, "fwm_user");
        
        SqlCommand cmd1 = ("Select email, password from fwm_user");  
        SqlDataReader dr;
        dr = cmd1.ExecuteReader();

        if (dr.Read())
        { 
            if(dr.GetString ........??????????????
        }
        
            }
2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by Haimanti
0
SqlConnection con = new SqlConnection("Data Source=SECANT-B0A227A3;Initial Catalog=Logins;integrated security=True;");
        SqlCommand cmd = new SqlCommand("select email,password from login", con);
        con.Open();
        SqlDataReader rdr = cmd.ExecuteReader();
        while (rdr.Read())
        {
           
            if ( txtboxemail.Text.Trim()==rdr[0].ToString().Trim() && textboxpassword.Text.Trim()==rdr[1].ToString().Trim())
            {
                Response.Redirect("~/Home.aspx");
            }
        }
0

Thank you so much. Now i can proceed further.[:)]

SqlConnection con = new SqlConnection("Data Source=SECANT-B0A227A3;Initial Catalog=Logins;integrated security=True;");
        SqlCommand cmd = new SqlCommand("select email,password from login", con);
        con.Open();
        SqlDataReader rdr = cmd.ExecuteReader();
        while (rdr.Read())
        {
           
            if ( txtboxemail.Text.Trim()==rdr[0].ToString().Trim() && textboxpassword.Text.Trim()==rdr[1].ToString().Trim())
            {
                Response.Redirect("~/Home.aspx");
            }
        }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.