I am attemping to create the following sql script into a subsonic query that I can use with a collection:
Select * from tableA
where tableA.InvoiceID = @Invoice
and tableA.VersionID = @VersionID
and tableA.ActiveDate >= GetDate()
and (tableB.InActiveDate is null or tableB.InActiveDate <= GetDate())
Here is my current code:
orders = new OrdersCollection();
query = new SubSonic.Query(Tables.Orders);
query.WHERE("InvoiceID", Invoice.InvoiceID);
query.AND("VersionID", version.VersionID);
query.AND("ActiveDate", SubSonic.Is.LessThanOrEqualTo(System.DateTime.Now.ToString()).Value);
query.AND("InActiveDate", SubSonic.Comparision.Is, null).OR("InActiveDate", SubSonic.Is.GreaterThanOrEqualTo("System.DateTime.Now.ToString()).Value);
query.CommandTimeOut = intSubSonicTimeOut; partXrefColl.Load(FilePartXref.FetchByQuery(query));
The problem that I think I am running into is that the evaulation of the dates and the OR statement. I have tried it with just the InvoiceID and VersionID and I get data back to the collection.
Any help will be greatly appreciated.