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.0help on DAL+ function pleasehelp on DAL+ function please
Previous
 
Next
New Post
5/1/2009 1:40 PM
 

I am using DAL+ methode to crete a module code but I got the folowing error on get function :

Object reference not set to an instance of an object.

I have  file on my APP_Code folder module called EmissionController.vb as controller and a file under the DesktopModules folder ListEmission.ascx.vb for listing the emissions and i want get just one emission by GetEmissionHoraire methode

in my  EmissionController.vb.vb I put the following code for the get methode ***

 Public Function GetEmissionHoraire(ByVal horaireID As Integer, ByVal moduleId As Integer) As EmissionHoraireInfo

            Return CType(CBO.FillObject(DotNetNuke.Data.DataProvider.Instance().ExecuteScalar("EmissionHoraireGet", horaireID, moduleId), GetType(EmissionHoraireInfo)), EmissionHoraireInfo)

        End Function

in my EmissionHoraireInfo.vb I put the following code for the get methode ***

            Dim EmissionController As New EmissionController

            Dim EmissionHoraireInfo As New EmissionHoraireInfo

            Dim emissionHoraireItem As EmissionHoraireInfo = EmissionController.GetEmissionHoraire(HoraireID, ModuleId)

            Label1.Text = emissionHoraireItem.HeureDebut
            Label2.Text = emissionHoraireItem.HeureFin
            Label3.Text = emissionHoraireItem.JourSemaine

 

please for those who have a large experience to deal with DAL+ tell me where is the problem in my code and thank you

 

 

 

 
New Post
5/1/2009 2:42 PM
 

CBO.FillObject takes an IDataReader instance as its first parameter, so you'll need to call ExecuteReader rather than ExecuteScalar from the DataProvider.

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
5/1/2009 9:18 PM
 

I change My code as folowing :

Public Function GetEmissionHoraire(ByVal horaireID As Integer, ByVal moduleId As Integer) As EmissionHoraireInfo

            Return CBO.FillObject(Of EmissionHoraireInfo)(CType(DotNetNuke.Data.DataProvider.Instance().ExecuteReader("EmissionHoraireGet", horaireID, moduleId), IDataReader))

        End Function

but this time i got the same error , pleeeeeeeeeeeeeeeeease help me how can I do a get in to an one record with an DAL+ methode 

 
New Post
5/4/2009 10:34 AM
 

Well, first of all, you don't need to cast the ExecuteReader call to an IDataReader, it already returns an instance of IDataReader (that is, remove CType( at the beginning and ), IDataReader at the end).

Can you provide a copy of the stack trace that you get when this error occurs (from the Event Viewer page)?  That should provide a file name and line number where the error occurs.

Alternatively, if you walk through the method in the debugger, can you see where the exception occurs?  Is it during the call to GetEmissionHoraire, or does that work correctly, but its return value is Nothing?  Does it happen in your imeplementation of Fill?

Hope that helps,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
5/4/2009 12:53 PM
 

Resolved , firsty I thank all those intersting on this topic the folowing code has been fixed the problem :

 

Public Shared Function GetHoraireEmission(ByVal horaireID As Integer, ByVal moduleId As Integer) As EmissionHoraireInfo
            Dim EmissionHoraireInfo As EmissionHoraireInfo = New EmissionHoraireInfo
            Using dr As IDataReader = DotNetNuke.Data.DataProvider.Instance().ExecuteReader("HoraireEmissionsGet", horaireID, moduleId)
                While dr.Read
                    EmissionHoraireInfo.HoraireID = Convert.ToInt32(dr("HoraireID"))
                    EmissionHoraireInfo.ModuleID = Convert.ToInt32(dr("ModuleID"))
                    EmissionHoraireInfo.EmissionID = Convert.ToInt32(dr("EmissionID"))
                    EmissionHoraireInfo.HeureDebut = Convert.ToString(dr("HeureDebut"))
                    EmissionHoraireInfo.HeureFin = Convert.ToString(dr("HeureFin"))
                    EmissionHoraireInfo.JourSemaine = Convert.ToString(dr("JourSemaine"))
                    EmissionHoraireInfo.JourSemaine = Convert.ToString(dr("ImagePath"))

                End While
            End Using
            Return EmissionHoraireInfo
        End Function

hope this help someone

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0help on DAL+ function pleasehelp on DAL+ function please


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