为什么2007-5-1变成了1905-6-23
dim i1,strSQL,i2,i3,i4
Dim Recordset2
Set Recordset2 = Server.CreateObject( "ADODB.Connection ")
Recordset2.ConnectionString = MM_conn_STRING
Recordset2.Open()
i2=Date()
i3=1
strSQL= "INSERT INTO TESTJF (TEST1,TESTDAY,TESTNUM)VALUES( 'test12 ' "& ", "&i2& ", "&i3& ") "
response.Write(i2)
response.Write(strSQL)
Recordset2.Execute(strSQL)
我使用这样的语句插入一条记录,今天本来是2007-5-1
response.Write(strSQL)的结果是INSERT INTO TESTJF (TEST1,TESTDAY,TESTNUM)VALUES( 'test12 ',2007-5-1,1)
但不知道为什么到了数据库中就变成了
1905-6-23
我把Date()+1数据库中的记录变成1905-6-22
我把Date()+2数据库中的记录变成1905-6-21
这是为什么啊
[解决办法]
TESTDAY 是datetime格式?
strSQL= "INSERT INTO TESTJF (TEST1,TESTDAY,TESTNUM)VALUES( 'test12 ' "& ",getdate, "&i3& ") "
这样呢?
[解决办法]
INSERT INTO TESTJF (TEST1,TESTDAY,TESTNUM)VALUES( 'test12 ', '2007-5-1 ',1)
[解决办法]
strSQL= "INSERT INTO TESTJF (TEST1,TESTDAY,TESTNUM)VALUES( 'test12 ' "& ", ' "&i2& " ', "&i3& ") "