|
<%
Function AddZero(val, digit)
Dim Ret
Ret = CStr(val)
Ret = Replace(Space(digit - Len(val)), " ", "0") & Ret
AddZero = ret
End Function
Function MFormatDataTime(dt, format)
Dim ret
ret = Replace(format, "MM", Month(dt))
ret = Replace(ret, "M",AddZero(Month(dt), 2))
ret = Replace(ret, "mm",Minute(dt) )
ret = Replace(ret, "m", AddZero(Minute(dt), 2))
ret = UCase(ret)
ret = Replace(ret, "YYYY", Year(dt))
ret = Replace(ret, "DD", Day(dt))
ret = Replace(ret, "D", AddZero(Day(dt), 2))
ret = Replace(ret, "HH", Hour(dt))
ret = Replace(ret, "H", AddZero(Hour(dt), 2))
ret = Replace(ret, "SS", Second(dt))
ret = Replace(ret, "S", AddZero(Second(dt), 2))
MFormatDataTime = ret
End Function
sql语言
StrSql="insert into Diary(Title,Reply,user_name,content,submit_date) values('" & tx1 & "','主题','版主','" & tx2 & "',#" & MFormatDataTime(Now(), "yyyy-MM-dd hh:mm:ss") & "#)"
上面的代码是有错的 请高手帮忙 |
|