Hi
I am using web application.
on my login button i have written this code
protected void btnlogin_Click(object sender, EventArgs e)
{
//sql connection
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = "Server=HOME-PC;Database=kandivalideal;Trusted_Connection=True;";
cnn.Open();
SqlCommand cmd = new SqlCommand("select mobileno, password from register where mobileno='"+txtmoblie.Text +"'and password='"+txtpassword.Text+"'",cnn);
cmd.Connection = cnn;
SqlDataReader dr = cmd.ExecuteReader();
if (txtmoblie.Text != "mobileno" && txtpassword.Text != "password")
{
Response.Write(@"<script language='javascript'>alert('Invalid Username and Password')</script>");
}
else
{
Response.Redirect("signup.aspx");
}
cnn.Close();
}
I think my If statement is giving me error it is not getting moblie no and password it is giving error by say invalid username and password