Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP & SQL Server: Dates
Message
De
09/08/2000 08:28:13
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, Royaume Uni
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00402704
Message ID:
00402729
Vues:
10
>Hi all,
>
>The question i have is:
>When i'm creating a string to use at a SQLEXEC(), i'm having a problem with dates, because SQL Server receives it from another format. Imagine this code:
>
>lcInstruction = "Update clients set date_payment = '" + ttoc(ldDatePay) + "' where codCli = ....."
>
>When i do a SELECT instruction from my table, i see that the date value is 2000-08-09, but the value of my update is wrong. And, to help wprst a little bit, TTOC() function doesn't give a dam with the SET DATE ...
>
>I know i could solve it with a remote view, but i don't want! I just want to make an update operation.
>
>Is there a way to get the date format from the SQL S.(and i could prepare the right instruction)?
>
>Any ideas?
>
>Thanks,
>
>Ricardo


Hi,

I think you'll have to go the long way round, i.e.

PADL( YEAR( ldDatePay), 4) + "-" + ;
PADL( MONTH( ldDatePay), 2, "0") + "-" + ;
PADL( DAY( ldDatePay), 2, "0") + " " + TIME( ldDatePay)

** Assumes ldDatePay is a datetime value, as your initial code suggests.
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform