📄 add.aspx
字号:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="system.configuration" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Dim myConnection As New SqlConnection
Sub Page_Load(Sender As Object, E As EventArgs)
myConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
if username.text="" or pic.SelectedValue="" or qq.text="" or email.text="" or topic.text="" or content.text="" then
msg.text="请填写完整的表单"
else
Dim InsertCmd As String = "insert into [gbdb] (username,qq,email,pic,topic,content,riqi) values (@username,@qq,@email,@pic,@topic,@content,@riqi)"
Dim MyCommand As New SqlCommand(InsertCmd, MyConnection)
MyCommand.Parameters.Add(New SqlParameter("@username", SqlDbType.VarChar, 20))
MyCommand.Parameters("@username").Value = username.text
MyCommand.Parameters.Add(New SqlParameter("@qq", SqlDbType.VarChar, 10))
MyCommand.Parameters("@qq").Value = qq.text
MyCommand.Parameters.Add(New SqlParameter("@email", SqlDbType.VarChar, 30))
MyCommand.Parameters("@email").Value = email.text
MyCommand.Parameters.Add(New SqlParameter("@pic", SqlDbType.VarChar, 50))
MyCommand.Parameters("@pic").Value = pic.SelectedValue
MyCommand.Parameters.Add(New SqlParameter("@topic", SqlDbType.VarChar, 30))
MyCommand.Parameters("@topic").Value = topic.text
MyCommand.Parameters.Add(New SqlParameter("@content", SqlDbType.Text, 5000))
MyCommand.Parameters("@content").Value = content.text
MyCommand.Parameters.Add(New SqlParameter("@riqi", SqlDbType.datetime, 8))
MyCommand.Parameters("@riqi").Value = now()
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
response.redirect("default.aspx")
end if
End Sub
</script>
<html>
<head>
<title>非非.net留言本</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
}
.style1 {color: #FFFFFF}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<!-- #include virtual="./top.inc" -->
<form runat="server">
<table border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#000000" style="WIDTH: 328px; HEIGHT: 184px">
<tbody>
<tr bgcolor="#000000">
<td colspan="2" height="25">
<div align="center"><span class="style1">发表留言</span></div>
</td>
</tr>
<tr bgcolor="#ffffff">
<td width="100" height="22">
<p align="right">
你的昵称:
</p>
</td>
<td width="216" height="22">
<asp:TextBox Columns="20" CssClass="input" id="username" MaxLength="20" runat="server"></asp:TextBox>
</td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<p align="right">
QQ号码:
</p>
</td>
<td height="22"><asp:TextBox ID="qq" CssClass="input" runat="server" Columns="10" MaxLength="10" /></td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<p align="right">
Email地址:
</p>
</td>
<td height="22"><asp:TextBox ID="email" CssClass="input" runat="server" MaxLength="30" /></td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<p align="right">
头像:
</p></td>
<td height="22"><asp:DropDownList ID="pic" CssClass="input" runat="server">
<asp:ListItem Value="" selected>请选择您的头像</asp:ListItem>
<asp:ListItem Value="1.gif">头像1</asp:ListItem>
<asp:ListItem Value="2.gif">头像2</asp:ListItem>
<asp:ListItem Value="3.gif">头像3</asp:ListItem>
<asp:ListItem Value="4.gif">头像4</asp:ListItem>
<asp:ListItem Value="5.gif">头像5</asp:ListItem>
<asp:ListItem Value="6.gif">头像6</asp:ListItem>
<asp:ListItem Value="7.gif">头像7</asp:ListItem>
<asp:ListItem Value="8.gif">头像8</asp:ListItem>
<asp:ListItem Value="9.gif">头像9</asp:ListItem>
<asp:ListItem Value="10.gif">头像10</asp:ListItem>
<asp:ListItem Value="11.gif">头像11</asp:ListItem>
<asp:ListItem Value="12.gif">头像12</asp:ListItem>
<asp:ListItem Value="13.gif">头像13</asp:ListItem>
<asp:ListItem Value="14.gif">头像14</asp:ListItem>
<asp:ListItem Value="15.gif">头像15</asp:ListItem>
<asp:ListItem Value="16.gif">头像16</asp:ListItem>
<asp:ListItem Value="17.gif">头像17</asp:ListItem>
<asp:ListItem Value="18.gif">头像18</asp:ListItem>
<asp:ListItem Value="19.gif">头像19</asp:ListItem>
<asp:ListItem Value="20.gif">头像20</asp:ListItem>
</asp:DropDownList> <a href="piclist.aspx" target="_blank">查看头像列表</a></td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<p align="right">
留言主题:
</p>
</td>
<td height="22">
<asp:TextBox id="topic" CssClass="input" runat="server" MaxLength="30" Columns="25"></asp:TextBox>
</td>
</tr>
<tr bgcolor="#ffffff">
<td height="22">
<p align="right">
留言内容:
</p>
</td>
<td height="22">
<asp:TextBox id="content" CssClass="input" runat="server" TextMode="MultiLine" Height="96px" Width="211px"></asp:TextBox>
</td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="2" height="22">
<p align="center">
<asp:Button id="Button1" onclick="Button1_Click" runat="server" Text="提交"></asp:Button>
</p>
</td>
</tr>
</tbody>
</table>
<p align="center">
<asp:Label id="msg" runat="server" forecolor="Red"></asp:Label>
</p>
<!-- #include virtual="./boot.inc" -->
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -