Object cannot be cast from DBNull to other types.

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/3/2012 1:45:11 PM
Gravatar
Total Posts 6

Object cannot be cast from DBNull to other types.

I have been using mojoportal version 2.3.9.0 MSSQL for a while. I am getting the following error. I did get this error before as well. I tried running some script for Publish mode for mp_Pages and mp_Modules; and set the HideAfterLogin to 0. Everything was working until I received this error again.

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: 
 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 
 

[InvalidCastException: Object cannot be cast from DBNull to other types.] System.DBNull.System.IConvertible.ToBoolean(IFormatProvider provider) +56 System.Convert.ToBoolean(Object value) +28 mojoPortal.Business.SiteUser.GetUser(IDataReader reader) +3106 mojoPortal.Business.SiteUser.GetUser(Int32 userId) +52 mojoPortal.Business.SiteUser..ctor(SiteSettings settings, Int32 userId) +835 mojoPortal.Business.SiteUser.GetNewestUser(SiteSettings siteSettings) +44 mojoPortal.Business.Statistics.MembershipStatistics.GetStatistics(SiteSettings siteSettings, DateTime today) +59 mojoPortal.Business.Statistics.MembershipStatistics..ctor(SiteSettings siteSettings, DateTime todaysDate) +81 mojoPortal.Business.WebHelpers.CacheHelper.LoadMembershipStatistics() +191 mojoPortal.Business.WebHelpers.CacheHelper.GetMembershipStatisticsFromCache() +287 mojoPortal.Web.MembershipStatisticsControl.PopulateControls() +338 mojoPortal.Web.MembershipStatisticsControl.Page_Load(Object sender, EventArgs e) +5 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91 System.Web.UI.Control.LoadRecursive() +74 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Control.LoadRecursive() +146 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

I did tried various different scripts on the forum without any luck. 

Please help !!!

Thanks.

 

 

12/3/2012 3:02:14 PM
Gravatar
Total Posts 6

Re: Object cannot be cast from DBNull to other types.

Never mind. Found and fixed the issue. 

It was mp_Users Roles_Changed field.

You must sign in to post in the forums. This thread is closed to new posts.