MDAC 2.5 SDK - ODBC Driver for Oracle


 

Setting the Date Format on Connection

The new version of the Microsoft ODBC Driver for Oracle does not automatically set the date format for Oracle date fields. Previously when the driver connected, it used ALTER SESSION SET NLS_DATE_FORMAT ='YYYY-MM-DD HH:MI:SS'.

To set the date format, call ALTER SESSION SET and then perform the insert. For example:

conn.Execute "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH:MI:SS' "
sSql = "INSERT INTO DATETEST VALUES (24,'1988-12-01 10:23:03')"
conn.Execute sSql