Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for a Null value
Message
De
01/02/2007 09:45:46
Jeff Corder
Ambit Technologies, LLC
Missouri, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01190997
Message ID:
01191337
Vues:
16
///
/// InventoryPK
///

public Guid InventoryPK
{
get
{
if (this.Row != null)
return (Guid)mmType.GetNonNullableDbValue(this.Row["InventoryPK"], "System.Guid");
else
return this._inventoryPK;
}
set
{
if (this.Row != null)
this.Row["InventoryPK"] = value;
this._inventoryPK = value;
}
}
private Guid _inventoryPK;

The problem comes in if I check to see if a value has been assigned. If the row has been created and nothing has been assigned, I get an error that it can't cast null to the Guid. In this instance, I can set the default when the row is created. In other circumstances, there really isn't a default.

Jeff
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform