Sir i am new to webservices and my scenario is that i want to display records from database against email and password. but when i debug webservices i recieved error. Here is my code
[WebMethod]
public bool CheckLogin(string Email, string Password)
{
return getEmail(Email, Password);
}
public bool getEmail(String Email, String Password)
{
SqlConnection NewCon;
NewCon = Class1.GetConnection();
NewCon.Open();
bool check = false;
string pa;
SqlCommand CheckCmd = new SqlCommand("SELECT * from RegisterUsers WHERE Email ='" + Email + "' and Password='" + Password + "'", NewCon);
CheckCmd.CommandType = CommandType.Text;
CheckCmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Email;
SqlDataReader sdr = CheckCmd.ExecuteReader();
while (sdr.Read())
{
pa = sdr.GetString(8); // for Password column
if (pa == Password)
{
check = true;
}
break;
}
NewCon.Close();
return check;
}