Records between two dates using subsonic
Hy. I have a table with two datetime columns (initialDate, finalDate), and i need to filter records where my variable varDate is between the values of the datetime fields.
it´s simple using SQL:
SELECT * FROM Table WHERE varDate BETWEEN initialDate AND finalDate
but, anyone can answer how do i get 开发者_运维问答these records using a SubSonic Query?
i've just tried every SubSonic statment, but it's just useless.. any method supported just need to compare table fields between values; and what i need its to compare value between table fields. thanks (and sorry for my english, i'm from Argentina)
You can try :
DB.Select().From("Purchase")
.Where("PurchaseDate").IsBetweenAnd(FromDate.DateTime, ToDate.DateTime)
.ExecuteAsCollection<PurchaseCollection>();
精彩评论