Link to home
Start Free TrialLog in
Avatar of mugsey
mugseyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

LINQ HOW TO SET DEFAULT MIN VALUE IN SMALDATETME COLUM

Came across a problem with nullable datetime columns and linq query.   Essentially I cannot query on datetime if the field is null in the database.

What is the best approach when adding a customer record with linq to sql server and setting a default value for the Date of Birth (DOB) column.

For the user the DOB is optional but I need to do a query that will return all records that have a DOB say greater than 1955.  

So what I need is a default value that is set and cannot be a valid date of birth but will also work with a linq query

For example

          var Data = from qryData in ReportData
                         where (qryData.DOB >= DOB)
                         select qryReportData;

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mugsey

ASKER

Thanks Bob