Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling DBNull in a Typed DataSet
Message
De
07/02/2008 14:19:00
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
Handling DBNull in a Typed DataSet
Divers
Thread ID:
01290537
Message ID:
01290537
Vues:
82
Just playing with a bit of LINQ against typed datasets.

The cdsEntities table was already filled in my DAL now I want to select a few rows from that DataTable into a new collection.

ParentID can be null and when I run the following query against the typed dataset it throws an exception.

StrongTypingException("The value for column \'ParentID\' in table \'cdsEntities\' is DBNull."
private void recurseTree(int? id, cdsTreeNode parent) 
  {
   var entities = from cdsEntitiesDS.cdsEntitiesRow e in ds.cdsEntities
                  where e.ParentID == id 
                  select e;
  }
I see a few ways around it, including editing the designer code and/or not using nulls.

The problem with editing the designer code is that I think I would have to redo it if I regenerate the dataset, which would be a pain.

I was wondering if there is another cleaner method of handling it.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform