>>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only