Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to filter the gridview when user select some item from dropdown. So I write this query code in edit value change event but my query is error

SQL
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

1) InvoiceDate before 01-04-2014
2) InvoiceDate startfrom 01-03-2014 endon 31-0302014
3) InvoiceDate thisweek that is last 7 days from now
4) InvoiceDate lastweek that is now(Today) - 14 days to +7 days
5) InvoiceDate ThisMonth that is last 30 days from now
6) InvoiceDate LastMonth that is now(today) - 60 days to +30 days

Help me to how to form query for this
Posted
Comments
Schatak 7-Apr-14 6:51am    
Definition of your table? Also all these condition should be matched or one of them?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900