return global variable value set inside loop
<pre><code>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 &lt; noofrows; i++)
        {
            if ((ds1.Tables["login"].Rows[i]["username_l"].ToString() == username) &amp;&amp; (ds1.Tables["login"].Rows[i]["password_l"].ToString() == password))
            {
                match = true;
            }
        }

    return match;
}
</code></pre>

<p>I want to return <code>match</code>  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?</p>
