Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

test Nullable attributes

1 view
Skip to first unread message

Peter Ghyselincks

unread,
Aug 2, 2006, 4:14:36 PM8/2/06
to
How can I test if an attribute is empty (or is holding a null).
in my case, the condition if
(oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsObject
== null) is allways false

What is wrong in my code ?

Thank you
Peter G.

<<code>>
/***************************************************************/
public class Lidmaatschap : ILoopBack
{
...

[UmlTaggedValue("Eco.AllowNULL", "True")]
[UmlTaggedValue("Eco.DefaultDBValue", "NULL")]
[UmlMetaAttribute("initialValue", "<NULL>")]
public DateTime LaatsteInschrijvingsdatum
{ get { return
((DateTime)(this.eco_Content.get_MemberByIndex(Eco_LoopbackIndices.LaatsteIn
schrijvingsdatum))); }
set {
this.eco_Content.set_MemberByIndex(Eco_LoopbackIndices.LaatsteInschrijvingsd
atum, ((object)(value))); }
}
/***************************************************************/
...
/***************************************************************/
if
(oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsObject
== null)
{
MyControls.dtLaatsteInschrijving.Visible = false;
MyControls.lblLaatsteInschrijving.Visible = false;
}
else
{
MyControls.dtLaatsteInschrijving.Value =
oLidmaatschap.LaatsteInschrijvingsdatum;
}


Jan Nordén

unread,
Aug 7, 2006, 11:06:06 AM8/7/06
to
Peter Ghyselincks wrote:

It certainly looks correct.

What happens if you actually assign a null, i.e.

oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsObje
ct = null;

is it still false?

> How can I test if an attribute is empty (or is holding a null).
> in my case, the condition if
> (oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsO

> bject == null) is allways false


>
> What is wrong in my code ?
>
> Thank you
> Peter G.
>
> <<code>>
> /***************************************************************/
> public class Lidmaatschap : ILoopBack
> {
> ...
>
> [UmlTaggedValue("Eco.AllowNULL", "True")]
> [UmlTaggedValue("Eco.DefaultDBValue", "NULL")]
> [UmlMetaAttribute("initialValue", "<NULL>")]
> public DateTime LaatsteInschrijvingsdatum
> { get { return
> ((DateTime)(this.eco_Content.get_MemberByIndex(Eco_LoopbackIndices.Laa
> tsteIn schrijvingsdatum))); }
> set {
> this.eco_Content.set_MemberByIndex(Eco_LoopbackIndices.LaatsteInschrij

> vingsd atum, ((object)(value))); }


> }
> /***************************************************************/
> ...
> /***************************************************************/
> if
> (oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsO

> bject == null)


> {
> MyControls.dtLaatsteInschrijving.Visible = false;
> MyControls.lblLaatsteInschrijving.Visible = false;
> }
> else
> {
> MyControls.dtLaatsteInschrijving.Value =
> oLidmaatschap.LaatsteInschrijvingsdatum;
> }

--

Peter Ghyselincks

unread,
Aug 8, 2006, 10:26:09 AM8/8/06
to
I can't reproduce mentioned behavior anymore. I think my databasesschema was
corrupt. (changes of 'is null' setting is not evolved to database etc)
My problem is solved.

the condition if
(oLidmaatschap.AsIObject().Properties["LaatsteInschrijvingsdatum"].AsObject
== null) is working properly!!!

Greetings
Peter G.

"Jan Nordén" <jan.n...@borland.com> schreef in bericht
news:44d7...@newsgroups.borland.com...

0 new messages