SQL Statement to Subsonic Query

subsonic

How do I write this SQL statement with Subsonic 2.2 Query Object?

SELECT * FROM Product
WHERE DateDiff(d, StartDate, GetDate()) >= 0 
AND DateDiff(d, EndDate, GetDate()) <= 0

Best Answer

You could do this another way if all your trying to achieve is make sure that a value is between two dates or greater than one and the other.

you'll just have to take the date calculation into the .net realm and feed it into your query using either

.Between()

or

    .AndExpression(Products.Columns.DateField).IsGreaterThan(X)
    .And((Products.Columns.DateField).IsLessThan(X)