Wednesday, March 7, 2012

How to get months and year

Hi All,

I provided the client with the dropdownlist which lists all the months (january - december). This input will be used to filter in the invoiceDT.

How can I write the query where clause to compare the invoiceDT (mm/dd/yyyy) into this input which is only number 1 through 12?

TIA

hi,

you can use following

" select * from table where ( datepart(mm,invoicedt) = "+ddlmonthfrom.SelectedIndex // i assume you've 1 additional item in dropdown.

the problem with this query is say you've 2 years data & you select say may, it will list data for may month of both years.

hope it helps,

regards,

satish.

No comments:

Post a Comment