public class loginbal
{
public static bool match = false ;
public bool check(string username, string password)
{
logindal LGD = new logindal();
DataSet ds1= LGD.logincheck(username, password);
int noofrows = ds1.Tables["login"].Rows.Count;
for (int i = 0; i < noofrows; i++)
{
if ((ds1.Tables["login"].Rows[i]["username_l"].ToString() == username) && (ds1.Tables["login"].Rows[i]["password_l"].ToString() == password))
{
match = true;
}
}
return match;
}
I want to return match but its not affected with for loop set statement what i can do to change match according to for loop value and return to method?
return truewhen you found a match. Also you are never resettingmatchtofalseso the method will always returntrueafter you have found a match once.matchvariable. Replacematch = truewithreturn true, andreturn matchwithreturn false. Presto.