PRB: ODBC Query Fails with Non-American Date FormatID: Q229854
|
When executing an ODBC Query against Visual FoxPro tables using the Visual FoxPro ODBC Driver, no records are returned when the WHERE clause includes a date that is not in AMERICAN date format.
The Visual FoxPro ODBC Driver only accepts dates in a strict AMERICAN date format.
Convert any dates that are passed in WHERE clause of the SQL Select statement to an AMERICAN date format.
This behavior is by design.
The default Visual FoxPro date setting is AMERICAN. Date formats, however, may be set to the following formats:
Date Setting | Date Format |
---|---|
AMERICAN | mm/dd/yy |
ANSI | yy.mm.dd |
BRITISH/FRENCH | dd/mm/yy |
GERMAN | dd.mm.yy |
ITALIAN | dd-mm-yy |
JAPAN | yy/mm/dd |
TAIWAN | yy/mm/dd |
USA | mm-dd-yy |
MDY | mm/dd/yy |
DMY | dd/mm/yy |
YMD | yy/mm/dd |
SHORT | Short date format determined by the Windows Control Panel short date setting. |
LONG | Long date format determined by the Windows Control Panel long date setting. |
CLEAR
DO CASE
CASE "6.0"$VERSION()
lcConnStr="DRIVER={Microsoft Visual FoxPro Driver};" + ;
"Exclusive=No;SourceType=DBF;SourceDB="+HOME(2)+"DATA"
CASE "5.0"$VERSION()
lcConnStr="DRIVER={Microsoft Visual FoxPro Driver};" + ;
"Exclusive=No;SourceType=DBF;SourceDB="+HOME()+"SAMPLES\DATA"
CASE "3.0"$VERSION()
lcConnStr="DRIVER={Microsoft Visual FoxPro Driver};" + ;
"Exclusive=No;SourceType=DBF;SourceDB="+HOME()+"SAMPLES\DATA"
ENDCASE
*!* Create An ADO Connection
oConnection=CREATEOBJECT("ADODB.Connection")
oConnection.ConnectionString = lcConnStr
oConnection.CursorLocation = 3
oConnection.OPEN
*lcSQL="SELECT * FROM ORDERS WHERE ORDER_DATE < {07/22/93}"
lcSQL="SELECT * FROM ORDERS WHERE ORDER_DATE < {93/07/22}"
*!* Create An ADO recordset
rs=CREATEOBJECT("ADODB.Recordset")
rs.activeconnection = oConnection
rs.CursorLocation = 3
rs.cursortype = 1
rs.LockType = 3
rs.OPEN(lcSQL)
IF !rs.EOF
rs.movefirst
DO WHILE !rs.EOF
? rs.FIELDS(0).VALUE
rs.movenext
ENDDO
ENDIF
rs.CLOSE
oConnection.CLOSE
lcSQL="SELECT * FROM ORDERS WHERE ORDER_DATE < {93/07/22}"
lcSQL="SELECT * FROM ORDERS WHERE ORDER_DATE < {07/22/93}"
Additional query words:
Keywords : kbDatabase kbMDAC kbODBC kbVFp600 KbDBFDBC kbGrpFox kbDSupport
Version : WINDOWS:2.0,2.1,3.0,3.0b,5.0,5.0a,6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: June 30, 1999