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

ASP数据库查询编辑的问题

首页

ASP数据库查询编辑的问题

我是ASP自学者。下面是一段数据库信息修改程序,我搞不太懂,那位老师能给讲解一下吗?

<%   
   Submit = Request.form("Submit")
   ID = Request.Form("ID")
   message=Request.Form("message")
   
   If Submit = "修改" Then  

      If ID="" Then
         Response.Redirect("NoteEdit.asp")
      End If

      First = "False"
      SetValue = ""      
          
     If message<>"" Then
         If First="True" Then SetValue = SetValue & ","
         SetValue = SetValue & "txtMessage='" & message & "'"
         First = "True"
      End If
     '上面这一段有两个if,为什么只有一个 end if 呼应呢?
         
      If First = "True" Then
         SQLStr = "Update MESSAGE Set " & SetValue & " Where ID=" & ID
      End If
   End If

   If First="False" Then
   Response.Redirect("NoteEdit.asp")
   End If
   
   Set Conn = Server.CreateObject("ADODB.Connection")
   
   Conn.Open("provider=microsoft.jet.oledb.4.0;data source="& 

server.mappath("MyWebSite.mdb"))

   Conn.Execute(SQLStr)

   Conn.Close
   Set RecordSet = Nothing
   Set Conn = Nothing
   
   '回显留言信息
   Response.Redirect("NoteEdit.asp")
%>


'尤其是First="False" …… If First="True" Then …… First="True" …… If First="True" Then 

…… If First="False" Then这一段是什么含义,应该怎样理解呢?用得着这么繁琐么?可不可以简化一

下呢?

提交回答
好评回答
  • 2008-07-28 14:44:30
    if 值为真(true) then
    '//当值为真的时候,执行本处代码
    else
    '//当值为假(false)时,执行本处代码
    end if
    Submit = Request.form("Submit")
    '//取从表单传过来的,submit关键字的值,并将值赋给变量Submit
    Set Conn = Server.CreateObject("ADODB.Connection") 
    '//建立数据库连接驱动
    Conn.Open("provider=microsoft.jet.oledb.4.0;data source="&server.mappath("MyWebSite.mdb")) 
    '//执行数据库连接
    Conn.Execute(SQLStr)
    '//执行sql语句

    轩***

    2008-07-28 14:44:30

类似问题

换一换
  • 网络软件 相关知识

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

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 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
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):