Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework
Nullable Values
Branimir Petrovic
11/5/2008 12:38:00 PM
Hi
I need to insert some data value in a table, what is the nullable value for
bool? , for string type i used String.Empty
TIA
Barry
2 Answers
Cowboy
11/5/2008 2:18:00 PM
0
"Barry" <someone@somewhere.com> wrote in message
news:eo7WQN0PJHA.728@TK2MSFTNGP05.phx.gbl...
> Hi
>
> I need to insert some data value in a table, what is the nullable value
> for bool?
bool? b = null;
If the bit field in the database is nullable, throwing a null at it, when
attempting an insert or update, will work.
> for string type i used String.Empty
Why not just null.
string s = null;
The reason I suggest this is some databases have conditions where
string.empty is a valid answer that does not mean the same as null. In fact,
null equals an indeterminate value and an empty string is determinant, as it
is something instead of nothing.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://feeds.feedburner.com/Greg...
or just read it:
http://feeds.feedburner.com/Gre...
********************************************
| Think outside the box! |
********************************************
Branimir Petrovic
11/6/2008 8:29:00 AM
0
Hi
Inserting null is not possible as the datatype is bool not bool?, the
datatype is auto-generated by the dataset.
Barry
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote in
message news:%23vURGF1PJHA.1516@TK2MSFTNGP03.phx.gbl...
> "Barry" <someone@somewhere.com> wrote in message
> news:eo7WQN0PJHA.728@TK2MSFTNGP05.phx.gbl...
>> Hi
>>
>> I need to insert some data value in a table, what is the nullable value
>> for bool?
>
> bool? b = null;
>
> If the bit field in the database is nullable, throwing a null at it, when
> attempting an insert or update, will work.
>
>> for string type i used String.Empty
>
> Why not just null.
>
> string s = null;
>
> The reason I suggest this is some databases have conditions where
> string.empty is a valid answer that does not mean the same as null. In
> fact, null equals an indeterminate value and an empty string is
> determinant, as it is something instead of nothing.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> Subscribe to my blog
>
http://feeds.feedburner.com/Greg...
>
> or just read it:
>
http://feeds.feedburner.com/Gre...
>
> ********************************************
> | Think outside the box! |
> ********************************************
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Nullable Values
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password