Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MySQL problem with parameters
Message
De
02/03/2010 12:20:20
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
MySQL problem with parameters
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01452040
Message ID:
01452040
Vues:
113
I have a MySql table with a DateTime field. I want to get all the records for today.
ldDate = DATE()
=SQLEXEC(lnHandle,"SELECT * FROM myTable WHERE dtField = ?ldDate")
This produces no records, which is expected since I'm not accounting for the time portion of the field. But when I tried
=SQLEXEC(lnHandle,"SELECT * FROM myTable WHERE DATE(dtField) = ?ldDate")
I also got no records back. When I tried
ldDate = DATE()
lcDate = TRANSFORM(DTOS(ldDate),"@R 9999-99-99")
=SQLEXEC(lnHandle,"SELECT * FROM myTable WHERE DATE(dtField) = ?lcDate")
I got the records I wanted.

Could somebody tell me why passing a Date value doesn't work while passing a character representation of the date does work?

Thanks............Rich
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform