Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Error with my module in DNN 4.8Error with my module in DNN 4.8
Previous
 
Next
New Post
1/8/2008 1:34 PM
 

Hi,

I have a module written, and it worked fine in DNN 4.7 and all preceding versions. In DNN 4.8 it throws an exception. Here is the line from my controller class where the exception happens:

ArrayList formItemArray = CBO.FillCollection(DataProvider.Instance().GetFormItems(portalID, moduleID), typeof(FormItemInfo));

The error is:

Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

and the message is:

DotNetNuke.Services.Exceptions.PageLoadException: Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. ---> System.InvalidCastException: Invalid cast from 'System.Int32' to 'System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) at System.Int32.System.IConvertible.ToType(Type type, IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType) at DotNetNuke.Common.Utilities.CBO.HydrateObject(Object objObject, IDataReader dr) at DotNetNuke.Common.Utilities.CBO.CreateObject[T](IDataReader dr) at DotNetNuke.Common.Utilities.CBO.FillCollection[T](IDataReader dr) at helferlein.DNN.Modules.Form.Business.FormItemController.Get(Int32 portalID, Int32 moduleID) in d:\Web\dnn.local\App_Code\helferlein_Form\FormItemController.cs:line 71 at helferlein.DNN.Modules.Form.Form.Page_Load(Object sender, EventArgs e) in d:\Web\dnn.local\DesktopModules\helferlein_Form\Form.ascx.cs:line 149 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

The IDataReader DataProvider.Instance().GetFormItems(portalID, moduleID) does not throw an exception, but shows a RecordCount property of -1 - even if there are records returned from the stored procedure withe the approbriate parameters.

I also tried to change the call to the DAL by

List<FormItemInfo> formItemList = CBO.FillCollection<FormItemInfo>(DataProvider.Instance().GetFormItems(portalID, moduleID));

Throws the same error...

Any ideas? Any help would be appreciated.


Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
1/8/2008 1:44 PM
 

 

Did you replace your old web.config with the one included in the downloaded Dotnetnuke 4.8?

I ask this, as possibly the objectQualifier in web.config may have been changed since you upgraded:

<add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="~\Providers\DataProviders\SqlDataProvider\" objectQualifier="dnn_" databaseOwner="dbo" />

This can cause issues with DB-calls, depending on how your stored procedures and SQLDataprovider is setup.

You might set a breakpoint in your SQLDataprovider, and see exactly how the stored-procedure is being called:

Check to make sure the combined string DatabaseOwner & ObjectQualifier & "MedRec_Reports_Delete" = your stored proc name in your database.

 

 

SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier &

"MedRec_Reports_Delete"

, reportID)

 

 
New Post
1/9/2008 11:27 AM
 

Michael,

They made changes in 4.8.0 to the way that CBO hydrates objects.  I have noticed a few others with similar issues.

I believe that an easy workaround would be for you to implement the IHydratable interface in your information object.


-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
1/11/2008 10:48 AM
 

Mitch,

thanks for that tip, that was exactly what helped (even if I found out myself two days ago...).

Best wishes, Michael


Michael Tobisch
DNN★MVP

dnn-Connect.org - The most vibrant community around the DNN-platform
 
New Post
2/20/2008 4:57 AM
 

I'm having the same issue, but I have no clue on how to implement the IHydratable interface in my information object.

Any help on how to do that? or an example?

Thanks in advance.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Error with my module in DNN 4.8Error with my module in DNN 4.8


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out