Ich mag dieseNull Referenz Ausnahme
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 <= Getdate() AND" + " MLL.END_DATE > Getdate()";
int intNoOfMembers = Convert.ToInt32(cSQLHelper.myExecuteScalar(strSelectMentorQuery));
if (intNoOfMembers > 0)
{
blnAllow = true;
}
}
catch (Exception ex)
{
ExceptionLogger.LogException(ex);
blnAllow = false;
}
// Return the value
return blnAllow;
}
eine Funktion haben und ich dann, wenn wie diese
if ((Int32.Parse(Session["ROLE_ID"].ToString()) == 3) && (CheckMentorAccess() == true))
{
cmbempList.Visible = true;
}
aber es ist eine NULL-Verweis Ausnahme in der ersten Zeile der Probe über
werfenKann mir jemand helfen ..
Ist der Schlüssel "ROLE_ID" tatsächlich existieren in Session? – bblack