Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking for a Null value
Message
From
31/01/2007 14:09:05
James Hansen
Canyon Country Consulting
Flagstaff, Arizona, United States
 
 
To
31/01/2007 12:51:16
Jeff Corder
Ambit Technologies, LLC
Missouri, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01190997
Message ID:
01191054
Views:
11
Jeff,

Do you need to check for (Ent.InventoryPK == DBNull) ?

...Jim

>I am validating data for a row. When I check to see if a column contains valid data, I get an exception if it contains a null (InventoryPK is a required and non-null column)
> if (Ent.InventoryPK == null)...
>
>If it contains null, I want to set the value. However, obviously, if it contains a value I don't want to change it.
>
>The options I see are:
>- Put the whole thing in a try-catch and if I get the exception, assign it.
>- Check against the DataRow, in which case I lose the advantage of Entities
>
>I'm not real crazy about either, so I'm looking for a better solution.
>
>In the entity class, there is a check to see if the Row is null, in which case it returns whatever default value the local variable is set to. Would it make sense to also check to see if the column itself is null and return the same value?
>
>Thanks,
>Jeff
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform