Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling DBNull in a Typed DataSet
Message
De
08/02/2008 04:55:38
 
 
À
07/02/2008 14:19:00
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01290537
Message ID:
01290750
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
Hi,
Does this help:
http://msdn2.microsoft.com/en-us/library/bb386916.aspx
I think I prefer the .Field extension option
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform