3、添加:addgonggao.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/gonggao.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject (")
    MM_editCmd.ActiveConnection = MM_gonggao_STRING
    MM_ = "INSERT INTO gonggao (title, author, addtime, content) VALUES (?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, Request.Form("title")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 50, Request.Form("author")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, Request.Form("addtime")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 50, Request.Form("content")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "../gonggao/list.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<%
Dim rs3
Dim rs3_cmd
Dim rs3_numRows
Set rs3_cmd = Server.CreateObject (")
rs3_cmd.ActiveConnection = MM_gonggao_STRING
rs3_ = "SELECT title, content, author, addtime FROM gonggao" 
rs3_cmd.Prepared = true
Set rs3 = rs3_cmd.Execute
rs3_numRows = 0
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 9pt; font-family: "宋体"; }
.STYLE4 {
    color: #FF0000;
    font-weight: bold;
}
.url_menu {
    font-family: "宋体";
    font-size: 9pt;
    color: #000000;
    text-decoration: none;
}
-->
</style>
<link href="main.css" rel="stylesheet" type="text/css" />
<link href="../main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p class="STYLE4">当前位置:添加公告</p>
<form ACTION="<%=MM_editAction%>" METHOD="POST" id="form1" name="form1">
  <table width="606" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="88" class="STYLE2">公告标题</td>
      <td width="518" class="STYLE2"><label>
        <input name="title" type="text" id="title" size="50" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">发布者</td>
      <td class="STYLE2"><label>
        <input name="author" type="text" id="author" size="20" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">发布时间</td>
      <td class="STYLE2"><label>
        <input name="addtime" type="text" id="addtime" size="15" />
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2">内容</td>
      <td class="STYLE2"><label>
        <textarea name="content" cols="40" rows="6" id="content"></textarea>
      </label></td>
    </tr>
    <tr>
      <td class="STYLE2"> </td>
      <td class="STYLE2"> </td>
    </tr>
    <tr>
      <td class="STYLE2"> </td>
      <td class="STYLE2"><label>
        <input type="submit" name="button" id="button" value="提交" />
      </label>
        <label>
        <input type="reset" name="button2" id="button2" value="重置" />
      </label></td>
    </tr>
  </table>
  
  
  
  
  <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>  </p>
</body>
</html>
<%
rs3.Close()
Set rs3 = Nothing
%>