Hello Anu,
Though I am no veteran in this subject, the following occured to my mind when I was parsing your query. But remember I use MS SQL Server 2000 (and you can estimate my knowledge in my thread that is just below yours
1) Extract function is not appropriate in that situation (atleast not in SQL Server). The function required is DATEPART( ). So, your query transforms to:
[code]
strqueryDate = "SELECT DATEPART(year,INV_DATE) from INVOICE where DATEPART(year,INV_DATE) = " + CStr(intYear) + ""
[code]
2) I guess the comparision is a text comparision and hence your CStr function's output should be in single quotes. Hence your query re-transforms to:
[code]
strqueryDate = "SELECT DATEPART(year,INV_DATE) from INVOICE where DATEPART(year,INV_DATE) = '" + CStr(intYear) + "'"
[code]
Thats all as far as I can see. But if it is wrong, dont crush your teeth in my name....look for a better answer from some veteran.
Cheers
-Harsha.