SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll (2.0.0.60911)
SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll (2.0.0.60722)
LLBLGenPro 2, ASP.Net 2.0, C#, using Adapter.
RelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(HoldingplanBankAccountFields.PortfolioCode == portfolioCode);
// filter.PredicateExpression.Add(HoldingplanBankAccountFields.EffectiveTo == DateTime.MinValue).AddWithOr(HoldingplanBankAccountFields.EffectiveTo > DateTime.Now);
If you uncomment the last line, the following exception occurs:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
during .DataBind()
I know why this is occurring, because it's converting Nulls in the column of to SqlDateTime(DateTime.MinValue), and then trying to do the comparison(s).
How do I get around this to achieve the equivelant of this SQL?
select * from holdingplanbankaccount
where portfoliocode = '10000127'
and ((effectiveto is null) or (effectiveto >= '2006-10-20'))
holdingplanbankaccount is a SQLServer View, and null is a valid value for effectiveto as it indicates the plan is effective until cancelled.
I've seen some other posts about this exception, but they were about saving values back to the database.