两个日期之间的分隔日期

Separate dates between two dates

我有一个 table 存储我售出的产品,这个 table 有一列存储购买日期。

例如:

01/01/2015  200$
02/01/2015  200$
02/01/2015  200$
02/01/2015  200$
04/01/2015  200$
05/01/2015  200$

我想知道01年和03年我卖了多少

如何select数据?

我正在使用 Entity Framework 请给我在 EF 中的解决方案。

(from s in _db.SoldProducts 
 where s.SoldDate =< "01/01/2015" and s.SoldDate => 03/01/2015).ToList();

像这样。

可能是这样的:

DateTime sd = new DateTime(2015, 1, 1);
DateTime ed = new DateTime(2015, 1, 3);
Decimal s = _db.SoldProducts.Where(s.SoldDate >= sd && s.SoldDate <= ed)
           .Sum(x => x.Amount);