Hi,
I am using DB2 database and VB6 on Win XP. I need to select records from Database for some particular month. I am trying to extract YEAR from DATE field (named as INV_DATE) in database table INVOICE using the following code.
strqueryDate = "SELECT EXTRACT (YEAR from INV_DATE) from INVOICE where EXTRACT(YEAR from INV_DATE) = " + CStr(intYear) + ""
Set localrecordsetDate = AGFDB.CONAGF.Execute(strqueryDate)
totalRecCountDate = localrecordsetDate.RecordCount
this query runs well on DB2 database command window but while executing in code it gives me following error:
Run-time error '-2147217900(80040e14)':
[Microsoft][ODBC dBase Driver] Syntax error (missing operator) in query expression 'EXTRACT(YEAR from INV_DATE)'.
I am not able to understand what is wrong. Please help
Anurag