J'utilise VB2005 et SQL Server 2000.problème Datetime en VB 2005
PVAR_SQL_STR = "INSERT INTO GLR_US_PERIOD (ORG5_CODE,PERIOD_YEAR,PERIOD_CODE," _
"PERIOD_NO,FROM_DATE,TO_DATE,INSERT_USER,INSERT_DATE) VALUES " _
& "('" & PVAR_COMPANY_CODE & "' ,'" & TextBox1.Text & "','" & Serial1.Text & _
"'," & TextBox2.Text & ", '" + DateTimePicker1.Value.ToString("D") + "' ,'" + _
DateTimePicker2.Value.ToString("D") + "','" & PVAR_USER_CODE & "','" + _
Now.ToString("F") + "')"
Erreur de syntaxe conversion datetime de chaîne de caractères à cause de cette partie seulement:
Now.ToString("F")
Pourquoi, je ne sais pas, mais quand je change en
Now.ToString("D")
ça marche bien mais on économise s la date seulement. Je veux insérer la date et temps.
MERCI BEAUCOUP SIR MR/JON je l'ai essayé et ça marche très bien – haythamhamdy