Insert Date and Time into Access

2018-09-06 11:58

阅读:328

  <%
FunctionAccessDateTime(dateandtime)
DimmyDay
DimmyMonth
DimmyYear

myDay=Day(dateandtime)
IfLen(myDay)=1ThenmyDay=0&myDay

myMonth=Month(dateandtime)
IfLen(myMonth)=1ThenmyMonth=0&myMonth

myYear=Year(dateandtime)

AccessDateTime=myYear&-&myMonth&-&myDay&&Time()
EndFunction

Dimconnection
DimSQL,sConnString

SQL=InsertINTOtblDate(dDate)VALUES(#&AccessDateTime(NOW()))

sConnString=PROVIDER=Microsoft.Jet.OLEDB.4.0;&_
DataSource=&Server.MapPath(datedb.mdb)
connection.Open(sConnString)
connection.execute(SQL)

Connection.Close
SetConnection=Nothing
%>


评论


亲,登录后才可以留言!