Insert Date and Time into Access
2007-04-04 00:00
1126 查看
<%
Function AccessDateTime (dateandtime)
Dim myDay
Dim myMonth
Dim myYear
myDay = Day(dateandtime)
If Len(myDay)=1 Then myDay="0" & myDay
myMonth = Month(dateandtime)
If Len(myMonth)=1 Then myMonth="0" & myMonth
myYear = Year(dateandtime)
AccessDateTime = myYear & "-" & myMonth & "-" & myDay & " " & Time()
End Function
Dim connection
Dim SQL, sConnString
SQL="Insert INTO tblDate (dDate) VALUES (#" & AccessDateTime(NOW()) & "#)"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("datedb.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(SQL)
Connection.Close
Set Connection = Nothing
%>
Function AccessDateTime (dateandtime)
Dim myDay
Dim myMonth
Dim myYear
myDay = Day(dateandtime)
If Len(myDay)=1 Then myDay="0" & myDay
myMonth = Month(dateandtime)
If Len(myMonth)=1 Then myMonth="0" & myMonth
myYear = Year(dateandtime)
AccessDateTime = myYear & "-" & myMonth & "-" & myDay & " " & Time()
End Function
Dim connection
Dim SQL, sConnString
SQL="Insert INTO tblDate (dDate) VALUES (#" & AccessDateTime(NOW()) & "#)"
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("datedb.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open(sConnString)
connection.execute(SQL)
Connection.Close
Set Connection = Nothing
%>
相关文章推荐
- Insert Date and Time into Access
- FSM3.1-RROR: insert into j_mztj(TID,Person0,Person1,TJBZ,TJDate,TJDeptName,AgentID,AgentName,DeptID,DeptName,RecordTime,DataType)values('2014041410403
- 解决:"2013-01-06 00:00:00" is not a valid date and time.
- Inserting and Creating Tables Using INSERT/SELECT INTO
- Function modules: Date and Time
- net-snmp的dateandtime数据类型
- ACCESS的System.Data.OleDb.OleDbException: INSERT INTO 语句的语法错误
- Date and Time in C++
- Getting the Current Date and Time
- Get current time and date on Android
- Custom Date and Time Format Strings
- Insert data into a table using table variables and cross join
- XSD Date and Time Data Types
- Access 不能有Note 字段名,出现Insert into 语法错误
- QT26 show time and date
- JAVA Current date and time
- Java 8 Date Time API Example Tutorial – LocalDate, Instant, LocalDateTime, Parse and Format
- 安卓时间拾取器(DatePicker And TimePicker)
- Date and Time Format Patterns
- Insert a form into a pop-up modal with CTools and Drupal 7