SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 395.3k

Username & pwd verification ?

Oct 10 2013 9:36 AM
Hi


Is there any way out to verify username and password using sql query to DB ..

Well actually i pre-requisite is i have say many columns i,e password and usernames ... so on 

I used query like this 

cmd = new SqlCommand("select username,password from studentform where username = " '+textbox1.text' and password= " '+textbox2.text ' " ,con); 
        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        if (dr.Read())
        {
            Server.Transfer("studentafterlogin.aspx");
        }
        else
        {
            Response.Write("<script> alert('Invalid credentials')</script>");
        }

In above in my command , The select statement NOT WORKING PROPERLY i am not getting anything to datareader EVEN i given correct credentials ?? Problem in query ??

Help it please ....

Answers (4)