资源简介
这个是用VS2008+SQL2005做的留言板,多多交流!
代码片段和文件信息
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.xml.Linq;
public partial class _Default : System.Web.UI.Page
{
DB DBManage = new DB();
ShowMes sm = new ShowMes();
Timer t = new Timer();
protected void Page_Load(object sender EventArgs e)
{
if (!IsPostBack)
{
t.Enabled = true;
this.time.Text = System.DateTime.Now.ToString();
Random rd = new Random();
string rand = Convert.ToString(rd.Next(10000 99999));
this.Validator.Text = rand;
this.Label1.Text=Application [“online“].ToString()+“\t人“;
this.Label2.Text = Application[“total“].ToString() + “\t人“;
}
}
protected void SubmitlinkButton_Click(object sender EventArgs e)
{
if (this.ValidatorTextBox.Text.Equals( this.Validator.Text))
{
this.RequiredFieldValidator3.IsValid = true;
}
else
{
this.RequiredFieldValidator3.IsValid = false;
}
string name = this.NameTextBox.Text;
string content = this.MessageTextBox.Text;
string SqlStr=“insert into mes(namecontent)values(‘“+name+“‘‘“+content+“‘)“;
int n;
if (this.RequiredFieldValidator1.IsValid == true && this.RequiredFieldValidator2.IsValid == true && this.RequiredFieldValidator3.IsValid == true)
{
n = DBManage.Command(SqlStr);
if (n > 0)
{
Response.Redirect(“ShowResult.aspx?sendmes=恭喜,留言成功!“);
}
}
this.NameTextBox.Text = ““;
this.MessageTextBox.Text = ““;
this.ValidatorTextBox.Text = ““;
}
protected void ClearlinkButton_Click(object sender EventArgs e)
{
this.NameTextBox.Text = ““;
this.MessageTextBox.Text = ““;
this.ValidatorTextBox .Text = ““;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 39934 2008-04-01 21:23 image\bj.jpg
文件 4945 2007-07-18 09:38 image\from.gif
目录 0 2008-05-28 09:46 image
文件 1942 2008-05-28 09:41 51aspx源码必读.txt
文件 7211 2008-04-11 12:19 Default.aspx
文件 2269 2008-04-03 17:19 Default.aspx.cs
文件 999 2008-04-03 00:51 foot.ascx
文件 456 2008-04-02 18:06 foot.ascx.cs
文件 4945 2007-07-18 09:38 from.gif
文件 2118 2008-04-03 16:51 Global.asax
文件 3533 2008-04-03 00:44 ShowMes.ascx
文件 3308 2008-04-03 00:49 ShowMes.ascx.cs
文件 741 2008-04-02 08:44 ShowResult.aspx
文件 524 2008-04-02 08:23 ShowResult.aspx.cs
文件 8068 2008-04-01 22:57 web.config
文件 546 2008-05-28 09:41 说明.txt
文件 125 2007-03-27 14:33 最新Asp.Net源码下载.url
文件 1391 2008-05-28 09:29 App_Code\DB.cs
目录 0 2008-05-28 09:29 App_Code
文件 2293760 2008-05-28 09:42 App_Data\message.mdf
文件 573440 2008-05-28 09:42 App_Data\message_log.LDF
目录 0 2008-04-03 00:32 App_Data
----------- --------- ---------- ----- ----
2950255 22
评论
共有 条评论