Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert DateTime to a string to send to SQL serv
Message
De
09/09/2010 06:37:13
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01480183
Message ID:
01480660
Vues:
54
>Hi,
>
>I want to send to the SQL Server the following update command:
>
>
>"update MyTable Set DateTimeColumn = " + TTOC(DateTime()) + " where Pk = " + nPk
>
>
>The TTOC() does not seem to do the job as SQL Server returns an error. What would be the right syntax for sending the current Date and Time to update SQL Serrver column?
>
>TIA.

I would suggest to go absolutely with parameters if you would send 'datetime()'. I wanted to note another point here:
ltTime = datetime()
SQLExec(m.lnHandle, 'update MyTable Set DateTimeColumn = ?m.ltTime where Pk = ?m.nPk')

* vs

SQLExec(m.lnHandle, 'update MyTable Set DateTimeColumn = getDate() where Pk = ?m.nPk')
are not the same thing and the latter use server's datetime. That may be a very important distinction depending on what you are doing.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform