Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why empty date in VFP has entry in .NET?
Message
From
28/05/2004 13:38:39
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00907017
Message ID:
00908242
Views:
28
>>>I retrieve a row from a VFP table, as datareader, where a date field has not entry (in VFP). But when I look at it in ASP.NET the date is there and it is 12/30/1899. I know I didn't enter any data in 1899 <g>. Who did?
>>>
>>>TIA.
>>
>>Dmitry,
>>
>>VFP's date type and .NET's datetime type are not exactly the same. You will have to manually convert 12/30/1899 to DbNull when you use the data.
>>
>>An alternative is to use a typed DataSet instead of a DataReader. You could edit the datetime column's Get accessor to return DbNull when the underlying data contains 12/30/1899.
>
>Keith,
>
>Thank you for your help. I will look up .net help on how to use DbNull (I don't know how to use it). Or I can check for the date to be greater than 1900 and consider everything before that date as empty. At this point, for this project, DataReader is my only choice.

If a lot of your projects use a VFP database, it might be a good idea to sub-class the OleDbDataReader and override the GetDateTime, GetValue and GetValues methods. Simply call the base class' method, then compare to 12/31/1899 and return DbNull where appropriate.

Actually, it would be a nifty little project to create a VFPClient namespace with VFP* classes, just like Sql*, Oracle* and OleDb* classes.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform