Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursoradapter with fox tables
Message
From
15/03/2010 14:10:20
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:
01454618
Views:
118
Yes you can have empty values but set your date/datetime fields to accpt null. You have to "translate to null" using conversion function. It is a problem of ADO/ODBC in general because only VFP (and VFP like xbase) have understanding of a date (before SQL 2008 of course) and datetime is stored as a numeric value where empty = 0 = base date = 1899/12/31
You can use F1 help.
Cetin

>So i can have empty values in my fields ? I have to transform this empty values in Null ? And this is a problem of the OleDb provider ?
>is this correct ?
>Where Can i find some docs about cursoradapter ?
>
>>>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