I have found it very frustrating trying to work with typed datasets and null
values. I'm starting to wonder if the typed dataset is more trouble than it
is worth. The problem is partly solved by the 'NullValue' property of the
typed dataset, but this only really works for reference types. For value
types you always need to check if the field is null with IsFieldNameNull()
before trying to reference the field. This makes databinding to a strong
typed dataset impossible as far as I can tell.
Surely I'm not the only one to encounter this problem.
Could someone please explain the recommended 'Best Practices' for dealing
with strong typed datasets and databinding. Thanks.

Re: Typed Dataset and Null Values by Miha

Miha
Sun Nov 23 11:46:10 CST 2003

Hi Elmer,


"Elmer Miller" <millere@empireco.nospam> wrote in message
news:egqS0HesDHA.2400@tk2msftngp13.phx.gbl...
> I have found it very frustrating trying to work with typed datasets and
null
> values. I'm starting to wonder if the typed dataset is more trouble than
it
> is worth. The problem is partly solved by the 'NullValue' property of the
> typed dataset, but this only really works for reference types. For value
> types you always need to check if the field is null with IsFieldNameNull()
> before trying to reference the field. This makes databinding to a strong
> typed dataset impossible as far as I can tell.

Use databinding like untyped DataSet:
textbox1.DataBindings.Add("Text", dataset.Tables[0], "Value");
It works since typed dataset is actually derived from untyped one.
I think that typed properties are more usefull within code than for
databinding.

> Surely I'm not the only one to encounter this problem.
> Could someone please explain the recommended 'Best Practices' for dealing
> with strong typed datasets and databinding. Thanks.

See above.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com



Re: Typed Dataset and Null Values by Elmer

Elmer
Sun Nov 23 14:28:49 CST 2003

Thanks Miha,
I feel stupid for not realizing how simple it was. I can even cast the
typed DataRow back to a regular DataRow whenever I want too. This works
great. Thanks again.

"Miha Markic" <miha at rthand com> wrote in message
news:eyv7vmesDHA.540@tk2msftngp13.phx.gbl...
> Hi Elmer,
>
>
> "Elmer Miller" <millere@empireco.nospam> wrote in message
> news:egqS0HesDHA.2400@tk2msftngp13.phx.gbl...
> > I have found it very frustrating trying to work with typed datasets and
> null
> > values. I'm starting to wonder if the typed dataset is more trouble than
> it
> > is worth. The problem is partly solved by the 'NullValue' property of
the
> > typed dataset, but this only really works for reference types. For value
> > types you always need to check if the field is null with
IsFieldNameNull()
> > before trying to reference the field. This makes databinding to a strong
> > typed dataset impossible as far as I can tell.
>
> Use databinding like untyped DataSet:
> textbox1.DataBindings.Add("Text", dataset.Tables[0], "Value");
> It works since typed dataset is actually derived from untyped one.
> I think that typed properties are more usefull within code than for
> databinding.
>
> > Surely I'm not the only one to encounter this problem.
> > Could someone please explain the recommended 'Best Practices' for
dealing
> > with strong typed datasets and databinding. Thanks.
>
> See above.
>
> --
> Miha Markic - RightHand .NET consulting & development
> miha at rthand com
>
>