Learn More





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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesHelp with error using DAL2 moduleHelp with error using DAL2 module
New Post
6/26/2014 9:39 AM

I'm trying to customize the DAL2 module template to view and insert data from an existing table but I'm getting an error (see below).

After I created the project, I changed the column names to match the columns in my existing table and did the same to the code but it's not working.

Another issue - when I add records, I get the same error although the records do get inserted in to the database. My guess is that the error is occurs after the record gets inserted and the page reloads to display all the records.

Does anyone know how I can trace this error?




System.NullReferenceException: Object reference not set to an instance of an object.
at DotNetNuke.Data.DataUtil.GetColumnName(PropertyInfo propertyInfo, String defaultName)
at DotNetNuke.Data.PetaPoco.PetaPocoRepository`1.GetScopeSql()
at DotNetNuke.Data.PetaPoco.PetaPocoRepository`1.GetByScopeInternal(Object propertyValue)
at DotNetNuke.Data.RepositoryBase`1.<>c__DisplayClass2`1.b__1(CacheItemArgs c)
at DotNetNuke.Common.Utilities.DataCache.GetCachedDataFromRuntimeCache(CacheItemArgs cacheItemArgs, CacheItemExpiredCallback cacheItemExpired)
New Post
6/27/2014 3:42 PM
the error suggests the issue is with the scoped data returned - I'd recommend double checking that attribute in case you scoped on a column that has now changed

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
New Post
7/2/2014 9:17 AM

Sorry for the delay; I just got back to this.

I'm still not having any luck. I did a find --> replace to ensure I had the table and collumns spelled correctly. I also scripted the table to a window and copied and pasted the exact names to the Item.cs file. Everything seems fine and like I stated in my initial post, the insert of new items works fine. The error occurs when the page loads and retrieves and binds the data to the repeater. Below is the error.

What I find odd is that I can remove everything from the repeater in view.ascx and still get the error. Here's my repeater with no mention of columns:

< asp: Repeater ID="rptItemList" runat="server" >
< /asp: Repeater >

This suugests to me that the error is occuring in another part of the project when this line is executed in view.ascx:

rptItemList.DataSource = tc.GetItems(ModuleId);

Again, this project works fine if I use the default settings. Once I remove the sql scripts from the 2 .SqlDatProvider files to use an existing table, I get this error.

I'm open to any tips or suggestions to get this working.

New Post
7/2/2014 3:15 PM
OK, I figured out the issue although I'm not entirely sure why it happened.

The issue involved the ModuleId. Since I needed to create a module to read data from an existing table that wasn't linked to a ModuleId, it was causing the error. I removed the reference to the ModuleId in the Item.cs file and also had to add new methods to the ItemController.cs file that didn't use the ModuleId and it worked.

Although I'm happy to have found the resolution I'd love to hear from anyone about root cause.

New Post
8/29/2015 11:19 PM
For others...

When I have run into this, it was because the Scope and Primary Key values are case-sensitive.

Will Strohl, former DNN Corp employee

My Blog

Twitter: @WillStrohl LinkedIn: Will Strohl on LinkedIn

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesHelp with error using DAL2 moduleHelp with error using DAL2 module

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.
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?