despite I use codesmith template to generate a DAL+ data access layer I got the following error when i use the module to populate a text boxes :
Error: Emission is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Common.Utilities.CBO.FillObject(IDataReader dr, Type objType, Boolean ManageDataReader) at DotNetNuke.Common.Utilities.CBO.FillObject(IDataReader dr, Type objType) at Company.DNN.Modules.PA.Business.EmissionController.GetHoraireEmission(Int32 horaireID, Int32 moduleId) in C:\DotNetNuke40\App_Code\Emissions\EmissionController.vb:line 33 at Company.DNN.Modules.PA.Business.ListEmission.Page_Load(Object sender, EventArgs e) in C:\DotNetNuke40\DesktopModules\Emissions\ListEmission.ascx.vb:line 44 --- End of inner exception stack trace ---
this is the code from the Controller:
Public Function GetHoraireEmission(ByVal horaireID As Integer, ByVal moduleId As Integer) As EmissionHoraireInfo
line 32 start here --> Return CType(CBO.FillObject(DotNetNuke.Data.DataProvider.Instance().ExecuteScalar("HoraireEmissionsGet", horaireID, moduleId), GetType(EmissionHoraireInfo)), EmissionHoraireInfo)
End Function
and this is the code in the ascx page :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim EmissionController As New EmissionController
'Dim emissionHoraireInfo As New EmissionHoraireInfo
Dim emissionHoraireItem As New EmissionHoraireInfo
line 44 start here ---> emissionHoraireItem = EmissionController.GetHoraireEmission(HoraireID, ModuleId)
If Not emissionHoraireItem Is Nothing Then
Label1.Text = emissionHoraireItem.HeureDebut.ToString()
Label2.Text = emissionHoraireItem.HeureFin.ToString()
Label3.Text = emissionHoraireItem.JourSemaine.ToString()
End If
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
and thanks for intersting.