[英]How to set filter for GridView in EditValue changed ? Winforms Devexpress
I need to filter the gridview when user select some item from dropdown. 当用户从下拉列表中选择某些项目时,我需要过滤gridview。 So I write this query code in edit value change event but my query is error
所以我在编辑值更改事件中写入此查询代码,但查询错误
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
I have 6 conditions here to filter this invoice date 我在这里有6个条件来过滤此发票日期
1) InvoiceDate before 01-04-2014 1)2014年1月4日之前的发票日期
2) InvoiceDate startfrom 01-03-2014 endon 31-0302014 2)发票日期从2014年3月3日开始到2014年3月30日结束
3) InvoiceDate thisweek that is last 7 days from now 3)这周的InvoiceDate是从现在开始的过去7天
4) InvoiceDate lastweek that is now(Today) - 14 days to +7 days 4)现在(今天)上周的InvoiceDate-14天到+7天
5) InvoiceDate ThisMonth that is last 30 days from now 5)从现在起过去30天的InvoiceDate ThisMonth
6) InvoiceDate LastMonth that is now(today) - 60 days to +30 days 6)现在(今天)的InvoiceDate LastMonth-60天至+30天
Help me to how to form query for this 帮助我如何对此进行查询
I think there is an issue in how you pass the date. 我认为您如何安排日期存在问题。
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';
This might work or pass the date as CDate('06-04-2014') 这可能有效或将日期设置为CDate('06 -04-2014')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.