【发布时间】:2014-05-19 13:18:09
【问题描述】:
当用户从下拉列表中选择某些项目时,我需要过滤网格视图。所以我在编辑值更改事件中编写了这个查询代码,但我的查询是错误的
SELECT InvoiceId, InvoiceNumber, InvoiceDate,
(Select CustomerId from Customer Where Customer.CustomerId=NewInvoice_1.CustomerName) AS CustomerId,
(Select CustomerName from Customer where Customer.CustomerId = NewInvoice_1.CustomerName) AS CustomerName,
DueDate, Tax, GrandTotal, CompanyId
FROM NewInvoice_1
Where InvoiceDate < 06-04-2014; // error in where condition
我在这里有 6 个条件来过滤此发票日期
1) 2014 年 1 月 4 日之前的发票日期
2) 发票日期从 01-03-2014 endon 31-0302014 开始
3) 从现在起最后 7 天的本周发票日期
4) InvoiceDate 上周即现在(今天) - 14 天到 +7 天
5) InvoiceDate ThisMonth 从现在起最近 30 天
6) InvoiceDate LastMonth 现在(今天) - 60 天到 +30 天
帮助我了解如何对此进行查询
【问题讨论】:
-
为什么要使用 devexpress 过滤器选项而不是
DataView过滤器?
标签: c# sql winforms ms-access gridview