📄 add.aspx
字号:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
' Insert page code here
'
Sub Button1_Click(sender As Object, e As EventArgs)
dim mytitle as string=textbox1.text
dim mycontent as string=textbox2.text
if trim(mytitle)="" or trim(mycontent)="" then
label1.text="必须填写"
label2.text="必须填写"
label3.text=""
end if
if trim(mytitle)<>"" and trim(mycontent)<>"" then
label3.text="新通知发布成功!"
label1.text=""
label2.text=""
dim conn as oledbconnection
dim sql as string
sql="insert into notice(title,content) values('"& mytitle &"','"& mycontent &"')"
conn=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("notice.mdb"))
conn.open
dim cmd as oledbcommand = new oledbcommand(sql,conn)
cmd.executenonquery()
conn.close()
response.redirect ("index.aspx")
end if
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<p align="center">
<strong>发布新通知</strong>
</p>
<p align="center">
<table width="650" bgcolor="#e0e0e0" border="1">
<tbody>
<tr>
<td>
通知标题:</td>
<td>
<asp:TextBox id="TextBox1" runat="server" autopostback="false"></asp:TextBox>
<asp:Label id="Label1" runat="server" autopostback="false"></asp:Label></td>
</tr>
<tr>
<td>
通知内容</td>
<td>
<asp:TextBox id="TextBox2" runat="server" autopostback="false" TextMode="MultiLine" Width="350px" Height="120px"></asp:TextBox>
<asp:Label id="Label2" runat="server" autopostback="false"></asp:Label></td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="可以发布"></asp:Button>
</td>
</tr>
</tbody>
</table>
<!-- Insert content here -->
</p>
</form>
<p>
</p>
<p align="center">
<asp:Label id="Label3" runat="server" autopostback="false" width="618px"></asp:Label>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -