>I am trying to use cursoradapter class to acces fox tables....i know that this is not the best way to do it...but i have to make a multidatabase application and i need now to access fox tables and in the future sql tables....so i use cursoradapter to make the switch to sql in less time. Once i create the class and i have my cursor open if i append a new record i have a problem if in the table i have a date fields. If i don't compile it i receive an error message. My fox tables are not in a DBC container and are free tables....but i have the problem also with tables in dbc......Then all the empty date columns when i look at table with browse after use Table command are empty. If i use cursoradapeter these values are 30-12-2899.......
Michele,
I have bitten the bullet and exactly did the same thing. Use a conversion function and convert empty values to nulls. ie:
define class CA_MyTable
* ...
ConversionFunc = "S TRIM, Sdate E2N"
Enddefine
*e2n.prg
Lparameters tuValue
If Empty(NVL(m.tuValue,0)) OR (Vartype(m.tuValue) = 'C' And Trim(m.tuValue) == '{}')
Return .Null.
Else
Return m.tuValue
Endif
Be carefull with datetime fields. Using VFPOLEDB (from within VFP code) datetime fields lose their time component. It is a BUG in my book and unlikely that it would be corrected. I needed to change my handler routines recently just for this reason. Other than that I am happy with the result. I can now truely change the backend just changing the connection string (in design, test and runtime).
Cetin