好的,这个总能得到我。我需要将值插入我的SQL数据库。列之一是DateTime,并设置为接受Null值。
如果字符串为空,则插入1900-01-01 00:00:00.000。我知道SQL将空值转换为1900-01-01 00:00:00.000。我希望它插入NULL。
我有这段代码:
iDateShipped = request.form("dateshipped")
If iDateShipped = "" Then
iDateShipped = null
End If
这也不起作用。
我的插入内容是:
sSQL = "INSERT into rma (companyname, contactname, dateshipped)"
sSQL = sSQL & "values('"& replace(strCompany,"'","''") &"','"& replace(strContact,"'","''") &"','"& iDateShipped &"')"
sSQL = sSQL & "SELECT @@IDENTITY"
Set rsNewRMA = ConnRMA.Execute(sSQL).NextRecordSet
rID = rsNewRMA(0)
rsNewRMA.close
set rsNewRMA=nothing
有什么想法吗?