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/6/2006 11:17 AM
 

Ok, I got an answer from a fellow CT member, but it's news to me, i honestly believed that it was possible to support all 3 values (note: i always use booleans as true/false, and don't allow null's, so have not encountered this before).

Answer:

"Yes, when using a nullable bit field on the db you actually only have two possible values: true or NULL. This is because we use NullBolean = false, so whenever a false is passed it will be converted to null. Given you use the GetNull(...) method.

Since Boolean only accepts two possible values True and False I can't see a workaround for this, without changing the related type.
When using booleans I always try to rely on ONLY two possible values 1/NULL, 1/0."


Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/6/2006 5:39 PM
 
Great work.  Thanks so much.  Not the news I was hoping for but it makes sense to me.  I really appreciate it.  Now I'm off to change my code...got quite a bit of work to do.  Thanks again.

I'm too poor for anything other than the community version
 
New Post
6/26/2006 5:52 PM
 
Found a relatively easy fix to my issue thanks to Ged over at vbcity.com which is to replace my boolean properties of my object with an enumerable.

In my infoobject.vb after "END CLASS" but before the last line I put in:

Public Enum MyOwnType
  No
  Yes
  Null
End Enum

This enum assigns the value of 0 for "no", 1 for "yes", and 2 for "null"

Then I replace the boolean type in my object with type MyOwnType (which can hold only the three values I specified).

I use Cathal's suggestion for the Constructor and set _myproperty = myowntype.null so that it's set to NULL if it isn't specified outright in an instance of an object.

I do not use the Getnull() in the SqlDataProvider when passing this field.

Then in my AddObject Stored Procedure I change the @myproperty from bit to int.  I do a check for the passed variable and it it is "2" then I set it to null before it's inserted into the database.  That way I don't have to change my datatypes in the database from boolean.

Basically, since the Boolean type doesn't do what it should (in my opinion), I just create my own type and use that.

I'm too poor for anything other than the community version
 
New Post
1/24/2007 7:07 PM
 
Hello... this is my first post, and I don't really know if I understood your problem.
Your are trying to pass a null value to a stored procedure parameter if I undertood right, so maybe you could change your stored procedure.
Declare your parameters like this:

PROCEDURE [dbo].[xxxx]
    @myParam1           varchar(25),
    @myParam2          varchar(25),   
    @myParam3           varchar(15) = NULL,
    @myParam4           varchar(50) = NULL  
AS
BEGIN... 
END 

In your app, you can just send a null value if you wante the value to be null. Hope I'm correct about your problem... If not I'm sorry...

See ya
 
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