This is more difficult, because a Decimal cannot have a null value - by
default it has a value of 0.
Now, when you are getting a value out of a datatable or datareader, you can
get either a DBNull, or an actual decimal value. The most common class for
these is object - so you could always pass around an object, and then always
have to test whether or not it is a DBNull, or an actual decimal.
SqlDataReader class (if you are using sql server) has a GetSqlDecimal method
which returns a SqlDecimal datatype. This structure is like the Decimal
structure, except it has the concept of a Null value.
"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
We have a SQL Server table with a decimal column that is not required.
We're building a .NET application for data entry. If the value is
optional, but a decimal is strongly typed in C# and cannot be assigned a value of
null, what are the best practices for dealing with passing this
potentially null value around in a Decimal C# datatype?
Thanks in advance.
Mark