Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO problem date and time fields
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00364980
Message ID:
00365129
Vues:
23
When you use the OLE-DB Provider for ODBC, I beleive empty dates are returned as 12/30/1899 12:00:00 AM. If you have a blank date in a VFP Cursor and you query that value from the ADO Recordset, this is the date you get.

What appears to never work is something like this:

ors.fields("mydate").Value = {}

Rather, if you want an empty date, you would need to do this:

ors.fields("mydate").Value = {12/30/1899}

Of course, what do you do if 12/30/1899 is a valid date? As near as I can tell, there is no way to get the ODBC Driver to interpret this as anything but a blank date... This is why Null is important. If the field is null, then it is truly empty. If it is empty, then the date is 12/30/1899. If it is anything else, then the correct date will appear...

So with this in mind, you can techncially have empty dates without having the field accept nulls..


>Hi John;
>
>So the only way to have a field accept blank values is to set it to accept nulls?
>
>>Most likely, your date field is not setup to accept nulls. Be sure to check this box in the structure dialog, and all should then work fine...
>>
>>>I am using ADO with Fox databases
>>>
>>>How kan i clear a date or time field
>>>If i put an empty date or time field i get an error
>>>
>>>how can help me
>>>
>>>kind regards
>>>
>>>
>>>Jan Dorresteijn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform