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

Click here to load this message in the networking platform