-------------------------------------------------------------------------------- [BUG/PRB.] VFP 9.0 FIX - FIX THE DATETIME DATA FOR THE VFPOLEDB DRIVER January 2024 -------------------------------------------------------------------------------- CCB 1. BUG: There is a test program from Mr. Cetin Basoz: *PROC testdatetimedataforvfpoledb Local loCon As Adodb.Connection,; loCmd As Adodb.Command, ; loParm As Adodb.Parameter loCon = Createobject('AdoDb.Connection') loCmd = Createobject('Adodb.Command') loCon.ConnectionString='Provider=VFPOLEDB;Data Source=test.dbc' loCon.Open() loCmd.ActiveConnection=loCon loCmd.CommandText='update test set fld2 = ? where fld1 = 0' loParm = loCmd.CreateParameter('fld2') loParm.Type = 135 && adDBTimeStamp loParm.Value = Datetime(2018,9,20,10,20,30) loCmd.Parameters.Append( loParm ) loCmd.Execute() loCon.Close Use test Locate for fld1 = 0 Browse Use RETURN * END OF PROC TESTDATETIMEDATAFORVFPOLEDB. Usually, we think fld2 is always equal to DATETIME(2018,9,20,10,20,30), But now fld2 is equal to DATETIME(2018,9,20,0,0,0), the TIME data has been lost. 2. CAUSE: There are some BUGs in the VFPOLEDB driver, it saves the DATETIME data to the DATE data somewhere, so the TIME data has been lost. 3. RESOLUTION: We can write some code to fix the BUG. Label53d838 :: mov eax , dword ptr [ Data937220 ] ;0x0053d838 : a120729300 mov dword ptr [ ebp + 0FFFFFEC4h ] , eax ;0x0053d83d : 8985c4feffff xor eax , eax ;0x0053d843 : 33c0 inc eax ;0x0053d845 : 40 mov dword ptr [ ebp - 4 ] , eax ;0x0053d846 : 8945fc mov dword ptr [ Data93da28 ] , eax ;0x0053d849 : a328da9300 mov eax , dword ptr [ ebp - 56 ] ;0x0053d84e : 8b45c8 mov ecx , dword ptr [eax] ;0x0053d851 : 8b08 lea edx , dword ptr [ ebp + 0FFFFFF44h ] ;0x0053d853 : 8d9544ffffff push edx ;0x0053d859 : 52 lea edx , dword ptr [ ebp + 0FFFFFED0h ] ;0x0053d85a : 8d95d0feffff push edx ;0x0053d860 : 52 push dword ptr [ ebp - 52 ] ;0x0053d861 : ff75cc push dword ptr [ ebp - 92 ] ;0x0053d864 : ff75a4 pushd 03h ;0x0053d867 : 6a03 push dword ptr [ ebp - 116 ] ;0x0053d869 : ff758c pushd offset Data9223dc ;0x0053d86c : 68dc239200 push dword ptr [ ebp + 0FFFFFF14h ] ;0x0053d871 : ffb514ffffff push eax ;0x0053d877 : 50 call dword ptr [ ecx + 24 ] ;0x0053d878 : ff5118 mov dword ptr [ ebp - 48 ] , eax ;0x0053d87b : 8945d0 ; ; --------------------------------------------------------------------- ; VFP 9.0 FIX - FIX THE DATETIME DATA FOR THE VFPOLEDB DRIVER ; September 2018 ; --------------------------------------------------------------------- ; CCB ; ; Fix the datetime data for the VFPOLEDB driver. ; ; 2018/9/20, by ccb ; call vfpa_fixdatetimedataforvfpoledb Label53d87e :: or dword ptr [ ebp - 4 ] , 0FFFFFFFFh ;0x0053d87e : 834dfcff mov eax , dword ptr [ ebp - 108 ] ;0x0053d882 : 8b4594 mov dword ptr [ Data93da28 ] , eax ;0x0053d885 : a328da9300 4. APPLIES TO: VFP 6.0.8167.0 VFP 6.0.8961.0 (SP5) VFP 7.0.0.9262 VFP 7.0.0.9465 (SP1) VFP 8.0.0.2521 VFP 8.0.0.3117 (SP1) VFP 9.0.0.2412 VFP 9.0.0.3504 (SP1) VFP 9.0.0.4611 (SP2) VFP 9.0.0.5015 (SP2) VFP 9.0.0.5411 (SP2) VFP 9.0.0.5721 (SP2) VFP 9.0.0.5815 (SP2) VFP 9.0.0.6303 (SP2) VFP 9.0.0.6602 (SP2) VFP 9.0.0.7423 (SP2) VFPOLEDB driver 8.0.0.2521 VFPOLEDB driver 9.0.0.2412 VFPOLEDB driver 9.0.0.5815 The bug has been fixed in VFP Advanced. 5. REFERENCE WEBSITES: 1, baiyujia.com: http://www.baiyujia.com http://www.baiyujia.com/vfpdocuments/f_vfp9fix42.asp 2, foxite.com: https://www.foxite.com/archives/bug-or-what-0000253993.htm 3, csdn.net: https://bbs.csdn.net/topics/392298164 4, microsoft.com: https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/datatypeenum?view=sql-server-2017 6. OTHER: For reference only, there is no guarantees. Any questions or suggestions, please send me an email at ccb2000@163.com. |