📄 updatecalendar_script.asp
字号:
<%@ Language=VBScript %>
<% Option Explicit %>
<%
' ---------- Page Functions ----------
Function ChkString(string)
ChkString = Replace(string, "'", "''")
End Function
' ---------- Page Variables ----------
Dim dailyMsg ' The messgae for that day
Dim dtCurrentDate ' The current date being updated
Dim objConn, strConn, strSQL, objRS ' Database Variables
' ---------- Variable Definitions ----------
dailyMsg = Request("calendarText")
dtCurrentDate = Request("currentDate")
Set objConn = Server.CreateObject("ADODB.Connection")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("db.mdb") & ";Persist Security Info=False;"
objConn.Open(strConn)
' Check to see if a message exists, if there is update/add it to the db, if not, delete the message
If Trim(dailyMsg) = "" then
StrSql = "DELETE FROM calendar WHERE calendarDate = #" & dtCurrentDate & "#"
Else
strSQL = "SELECT * FROM calendar WHERE calendarDate = #" & dtCurrentDate & "#"
Set objRS = objConn.Execute(strSQL)
If NOT objRS.EOF Then
strSQL = "UPDATE calendar SET calendarText = '" & ChkString(dailyMsg) & "' WHERE calendarDate = #" & dtCurrentDate & "#"
Else
strSQL ="INSERT INTO calendar (calendarDate, calendarText) VALUES (#" & dtCurrentDate & "#, '" & ChkString(dailyMsg) & "')"
End If
End If
objConn.Execute(strSQL)
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
Response.Redirect ("calendar.asp?currentDate=" & dtCurrentDate)
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -