爱问知识人 爱问教育 医院库

求高手解释一段asp代码

首页

求高手解释一段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(" b") & ";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 (" p?currentDate=" & dtCurrentDate)
%>     

提交回答

全部答案

  • 其他编程语言 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 168-187
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):