Re: Nullvalued doubles in a strong typed dataset by Thomas
Thomas
Mon Oct 27 09:50:20 CST 2003
Hi Nicole,
thanks for your answer.
OK, that's a good way to set the double variable to null. But my problem is
a litte bit more difficult. Maybe I'm blind and I can't see the solution.
The problem is that if I read a a System.DBNULL value from the database, I
can set my double to 0, but I can't set it to NULL, because this is invalid
for doubles. If I then put the value to a input element like a textbox, the
user cannt decide wheter the field in the database was empty or 0. And if I
put it back to the database I don't know if I should write 0 or NULL because
the double value is 0.
I tried to handle this with double.NaN. So if the value in the Database ist
empty I set my double to double.NaN and so I can handle it also back. The
problem is that the typed dataset does not accept double.NaN as a nullvalue.
To make the upper problem more difficult, I'd like to work with databinding.
So the dataset should be used as a datasourece for a editable datagrid.
Do you have a suggestion how to read System.DBNULL from a database to a
double value or do you know a workaround to handle the upper problems? How
do you do such things? I can't imagine I'm the first dealing with these
topics.
Thanks
Thomas
"Nicole Calinoiu" <nicolec@somewhere.net> schrieb im Newsbeitrag
news:umpqn6JnDHA.3312@tk2msftngp13.phx.gbl...
> Thomas,
>
> If the element is nillable, the row class built into the strongly typed
> dataset class should expose a Set<element name>Null method that you can
use
> to specify a null value when adding or modifying a row.
>
> HTH,
> Nicole
>
>
> "Thomas Schissler" <tschissler@artiso.com> wrote in message
> news:OgzGciGnDHA.3700@TK2MSFTNGP11.phx.gbl...
> > I have a strong typed dataset with some double values. In my database,
> from
> > where I fill the dataset, I have numbers for these doubles, but they can
> > also bee empty (NULL). I need this to know if the user has typed in 0 or
> > hase typed in nothing.
> >
> > If I set the nullvalue for the doubles in my dataset to (NULL), I get an
> > exception. How can I pass the System.DBNULL value from my database to my
> > doubles?
> >
> > Thanks
> > Thomas
> >
> >
>
>