Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handling DBNull in a Typed DataSet
Message
From
08/02/2008 04:55:38
 
 
To
07/02/2008 14:19:00
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01290537
Message ID:
01290750
Views:
15
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform