I believe u need quotes around the date (if using SQL).
The following works in a VFP-to-SQL environment:
mCommand = "UPDATE reports SET REPORTNAME='"+m.reportname+"',reportdate='"+DTOC(m.reportdate)+"' WHERE reportid='"+m.reportid+"'"
Which builds a string (mCommand) that looks like:
UPDATE reports
SET reportname='Reportname 1',reportdate = '12/15/2001'
WHERE reportid = 'A100'
>hi there! can anyone help me?
>
>can anyone show me how to use the sql update syntax for DateTime field?
>
>i have tried using this code in my SQL statement:
>mydate=now()
>sqlupdate = "UPDATE questions SET question = '"& request("question") &"', answer = '"& request("answer") &"', date = {"& mydate &"} WHERE id = " & myid
>
>and i keep on getting this error:
>Microsoft OLE DB Provider for SQL Server error '80040e14'
>Syntax error or access violation
>
>if anyone can help me i would be very thankful!
>
>thanks in advance!
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement