0
我使用VB2005和SQL Server 2000日期時間問題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") + "')"
語法錯誤從字符串轉換因爲只有這部分的日期時間:
Now.ToString("F")
爲什麼,我做不知道,但當我改變成
Now.ToString("D")
它運作良好,但它節省僅限日期。我想插入日期和時間。
非常感謝你先生MR/JON 我試過了,它工作得很好 – haythamhamdy 2010-06-02 08:37:16