Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
tell me about bit datatype can i give the integer value 2 to represnet null 0 to false and 1 to True
Posted

You could do this:

C#
[Flags]
enum MyType
{
    False = 0,
    True = 1,
    Null = 2
}


But honestly it does not make any sense. No value can ever be a combiantion of any of those flags.
 
Share this answer
 
Comments
Albin Abel 28-Apr-11 12:42pm    
[Flags]
enum MyType
{
False = 0,
True = 1,
Null = 2,
Vote = 5
} :)
Nish Nishant 28-Apr-11 12:43pm    
:-)
A bit can either be true (1) or false (0)
 
Share this answer
 
Bit column in SQl accept only (1, 0, NULL) values. Wht do you need "2" to represent as NULL. Use NULL directly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900