[英]How to set Filter in run time ? for gridview in C#, Winforms, DevExpress
[英]How to set filter for GridView in EditValue changed ? Winforms Devexpress
当用户从下拉列表中选择某些项目时,我需要过滤gridview。 所以我在编辑值更改事件中写入此查询代码,但查询错误
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)发票日期从2014年3月3日开始到2014年3月30日结束
3)这周的InvoiceDate是从现在开始的过去7天
4)现在(今天)上周的InvoiceDate-14天到+7天
5)从现在起过去30天的InvoiceDate ThisMonth
6)现在(今天)的InvoiceDate LastMonth-60天至+30天
帮助我如何对此进行查询
我认为您如何安排日期存在问题。
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';
这可能有效或将日期设置为CDate('06 -04-2014')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.