Null reference exception
<p>I have a function like this</p>

<pre><code>public bool CheckMentorAccess()
{
    bool blnAllow = false;
    try
    {
        string strSelectMentorQuery = "SELECT COUNT(DISTINCT MLL.LED_ID) FROM M_USER_DETAILS MUD INNER JOIN M_LEADERLED MLL " + "ON MLL.LED_ID = MUD.PK_ID WHERE MLL.LEADER_ID = '" + Session["UserID"].ToString() + "' AND MUD.ACTIVE = 1 AND MLL.START_DATE &lt;= Getdate() AND" + " MLL.END_DATE &gt; Getdate()";

        int intNoOfMembers = Convert.ToInt32(cSQLHelper.myExecuteScalar(strSelectMentorQuery));

        if (intNoOfMembers &gt; 0)
        {
            blnAllow = true;
        }
    }
    catch (Exception ex)
    {
        ExceptionLogger.LogException(ex);
        blnAllow = false;
    }

    // Return the value
    return blnAllow;
}
</code></pre>

<p>And then I use if like this </p>

<pre><code>if ((Int32.Parse(Session["ROLE_ID"].ToString()) == 3) &amp;&amp; (CheckMentorAccess() == true))
{
    cmbempList.Visible = true;
}
</code></pre>

<p>but it is throwing a null reference exception on the first line of the sample above</p>

<p>Can anyone help me out..</p>
