Server Error in '/' Application.

Object cannot be cast from DBNull to other types.

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: System.InvalidCastException: Object cannot be cast from DBNull to other types.

Source Error:


Line 135:
Line 136:            custId = Convert.ToInt32(DBReader["CustId"]); // Save Customer Id
Line 137:			catId = Convert.ToInt32(DBReader["CatId"]); // Save Category Id
Line 138:			if (DI_MultiCategoryEnabled)
Line 139:			{

Source File: d:\webs\fairgreentrade\dir\directory\ListingDisplay.aspx.cs    Line: 137

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
   System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider) +60
   Directory_ListingDisplay.Page_Load(Object sender, EventArgs e) in d:\webs\fairgreentrade\dir\directory\ListingDisplay.aspx.cs:137
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +90
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533


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