General information
Category:
The Mere Mortals .NET Framework
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only