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

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Passing Boolean Null From SqlDataProvider to Stored Procedure?Passing Boolean Null From SqlDataProvider to Stored Procedure?
Previous
 
Next
New Post
6/2/2006 1:17 PM
 

I tried modifying the Info Class as such but it still doesn't work:

Public Property ApplyENJPT() As Boolean

Get

Return _applyENJPT

End Get

Set(ByVal Value As Boolean)

_applyENJPT = Null.NullBoolean 'Trying this out

End Set

End Property


I'm too poor for anything other than the community version
 
New Post
6/2/2006 1:25 PM
 

Just a note on the GetNull() function.  My understanding is that function is there to smoothe over data being RETURNED from the database.  Not sure it's supposed to do anything with data going into the database although it obviously does.

The DNN book states: "Finally in order to handle null values returned from the database, DotNetNuke provides the GetNull method.  When you create a method for your database...you should wrap the parameters with the GetNull method.  This will prevent errors from being raised in your Data Provider due to the null values."

If only I could make it say "if the infoobject property is null....then make it null when you send it to the database - otherwise, keep it at true or false."  I'll try creating my own GetNull() function and see if that does anything.


I'm too poor for anything other than the community version
 
New Post
6/2/2006 1:32 PM
 

ah, sorry read the code too quick and didn't realise that your second constructor "Public Sub New(ByVal applyENJPT As Boolean)" was how you would set true/false. AFAIR you can't see the null values in the constructor, you can only set non-optional values. If you need to change the value then you call the public property. That way the initial start state is always null, and can be switched. In your case where you only have 1 value that is optional, you only need the default constructor with no parameters (i.e. the first sub new()). If your class had a mixture of mandatory and optional values, you would create constuctor(s) that only receive mandatory values as parameters and default the optional ones to their Null.* equivalents.

I'd recommend that you take a look at Components\Providers\Scheduling\ScheduleHistoryItem.vb and follow it's logic through as it contains an optional boolean (Succeeded).

Cathal


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/2/2006 1:39 PM
 

Thank you very much!

Sounds like you've given me the roadmap to make this work which is so great.  I had quite a lot of boolean values in my class and switching them all to integers would have really been some work.  Looking forward to the research.  Thanks again for the continued help.  You've helped me more over the last few years in the forums than anyone.  I appreciate it.


I'm too poor for anything other than the community version
 
New Post
6/2/2006 2:04 PM
 

BEAUTIFUL!  It works great.  Thanks Cathal.  Now to recap in case someone has the same issue.

Goal:  Have an InfoObject with boolean properties such that null boolean values are passed to the database Table when those boolean properties are null otherwise pass true or false.

Solution: Construct the Info Object boolean property as shown below and make sure the SqlDataProvider does in fact wrap the parameter with the GetNull() method.

INFO OBJECT CLASS

Public Class ScheduleHistoryItem

Private _Succeeded As Boolean

Public Sub New()

_Succeeded = Null.NullBoolean

End Sub

Public Sub New(ByVal objScheduleItem As ScheduleItem)

Me.AttachToEvent = objScheduleItem.AttachToEvent

Me.CatchUpEnabled = objScheduleItem.CatchUpEnabled

_Succeeded = Null.NullBoolean   'NOTE THE DIFFERENCE FROM THE OTHER PROPERTIES

End Sub

Public Property Succeeded() As Boolean

Get

Return _Succeeded

End Get

Set(ByVal Value As Boolean)

_Succeeded = Value

End Set

End Property

End Class


I'm too poor for anything other than the community version
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Passing Boolean Null From SqlDataProvider to Stored Procedure?Passing Boolean Null From SqlDataProvider to Stored Procedure?


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