Server Error in '/' Application.

Cannot perform runtime binding on a null reference

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference

Source Error:


Line 280:            var IStarDB = Database.Open("iStarODBCConnection");
Line 281:            var Dept = IStarDB.QuerySingle(SqlSelect);
Line 282:            DeptTitle = Dept["DeptTitle"].Replace("%DEPARTMENT%", (string)Dept["Name"]);
Line 283:
Line 284:            if(DeptTitle != null) {

Source File: c:\Inetpub\wwwroot\App_Code\iStar.cshtml    Line: 282

Stack Trace:


[RuntimeBinderException: Cannot perform runtime binding on a null reference]
   CallSite.Target(Closure , CallSite , Object , String ) +151
   System.Dynamic.UpdateDelegates.UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) +699
   CallSite.Target(Closure , CallSite , Object , String ) +184
   ASP.iStar.GetDeptTitleFromAdmin(String DeptCode) in c:\Inetpub\wwwroot\App_Code\iStar.cshtml:282
   ASP._Page_Browse_cshtml.Execute() in c:\Inetpub\wwwroot\Browse.cshtml:7
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +208
   System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +68
   System.Web.WebPages.WebPage.ExecutePageHierarchy() +123
   System.Web.WebPages.StartPage.RunPage() +19
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +67
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
   System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +121


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1022