Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter with fox tables
Message
From
15/03/2010 12:00:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01454562
Message ID:
01454578
Views:
99
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform