簡體   English   中英

如何在EditValue中設置GridView的篩選器已更改? 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM