資源簡介
開發語言asp.net,數據庫為SQL Server2000,能夠實現留言功能的簡潔的留言板

代碼片段和文件信息
using?System;
using?System.Data;
using?System.Configuration;
using?System.Collections;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.UI.HtmlControls;
public?partial?class?add?:?System.Web.UI.Page
{
????string?imageUrl;
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
????????if?(!IsPostBack)
????????{
????????????for?(int?i?=?1;?i?<=?10;?i++)
????????????{
????????????????this.ddlPic.Items.Add(“pic“?+?i.ToString()?+?“.gif“);//將頭像名字綁定到下拉列表上
????????????}
????????????this.Image1.ImageUrl?=?“images/face/“?+?ddlPic.SelectedValue;//綁定頭像具體的路徑
????????}
????}
????protected?void?Button1_Click(object?sender?EventArgs?e)
????{
????????//以下用來獲得用戶所填每一項的具體值
????????string?sex;
????????string?postTime?=?DateTime.Now.ToShortDateString();
????????string?userName?=?this.txtUserName.Text;
????????string?content?=?this.txtContent.Text;
????????string?imageUrl?=?ddlPic.SelectedValue;//用戶選定了哪個頭像
????????if?(this.rbtnNv.Checked?==?true)
????????{
????????????sex?=?“女“;
????????}
????????else
????????{
????????????sex?=?“男“;
????????}
????????SqlConnection?conn?=?DB.createCon();
????????SqlCommand?cmd?=?new?SqlCommand();
????????cmd.Connection?=?conn;
????????cmd.CommandText?=?“insert?into?guest(userNamesexcontentimageUrlfaceUrlpostTime)?values(‘“?+?userName?+?“‘‘“?+?sex?+?“‘‘“?+?content?+?“‘‘“?+?imageUrl?+?“‘‘“?+?imageUrl?+?“‘‘“?+?postTime?+?“‘)“;
????????if?(cmd.ExecuteNonQuery()?>?0)
????????{
????????????Response.Write(“ript>alert(‘留言成功!‘);location.href=‘default.aspx‘; ript>“);
????????}
????????else
????????{
????????????Response.Write(“ript>alert(‘留言失敗!‘);window.location?=?window.location; ript>“);
????????}
????}
????protected?void?Button2_Click(object?sender?EventArgs?e)
????{
????????this.txtUserName.Text?=?““;
????????this.txtContent.Text?=?““;
????}
????protected?void?ddlPic_SelectedIndexChanged(object?sender?EventArgs?e)
????{
????????this.Image1.ImageUrl?=?“images/face/“?+?ddlPic.SelectedValue;
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2949??2009-10-30?09:50??留言板\add.aspx
?????文件???????2275??2009-10-30?09:50??留言板\add.aspx.cs
?????文件????????778??2009-10-30?08:29??留言板\App_Code\db.cs
?????文件????1657344??2008-11-18?00:00??留言板\App_Data\00
?????文件?????917504??2008-12-09?00:00??留言板\App_Data\myBoard.mdf
?????文件????1048576??2008-12-09?00:00??留言板\App_Data\myBoard_log.LDF
?????文件???????1452??2007-08-20?00:00??留言板\App_Data\Sql.sql
?????文件????????640??2009-10-30?08:40??留言板\Controls\footer.ascx
?????文件????????782??2009-11-04?21:33??留言板\Controls\footer.ascx.cs
?????文件????????321??2009-11-04?21:33??留言板\Controls\header.ascx
?????文件????????422??2009-11-04?21:33??留言板\Controls\header.ascx.cs
?????文件???????3698??2008-10-21?00:00??留言板\Controls\st
?????文件???????8420??2009-10-30?09:07??留言板\Default.aspx
?????文件???????2904??2009-10-30?09:51??留言板\Default.aspx.cs
?????文件????????125??2004-03-17?00:00??留言板\images\001.gif
?????文件????????125??2004-03-17?00:00??留言板\images\002.gif
?????文件????????125??2004-03-17?00:00??留言板\images\003.gif
?????文件????????222??2004-05-29?00:00??留言板\images\004.gif
?????文件????????216??2006-04-06?00:00??留言板\images\a_delete.gif
?????文件????????710??2006-04-06?00:00??留言板\images\a_reply.gif
?????文件??????30375??2004-03-18?00:00??留言板\images\banner.gif
?????文件???????1778??2008-10-06?00:00??留言板\images\bj.gif
?????文件????????565??2006-04-06?00:00??留言板\images\delete.gif
?????文件???????1443??2004-12-28?00:00??留言板\images\face\face1.gif
?????文件???????2314??2004-12-28?00:00??留言板\images\face\face10.gif
?????文件???????1205??2004-12-28?00:00??留言板\images\face\face11.gif
?????文件???????1322??2004-12-28?00:00??留言板\images\face\face12.gif
?????文件???????1275??2004-12-28?00:00??留言板\images\face\face13.gif
?????文件????????996??2004-12-28?00:00??留言板\images\face\face14.gif
?????文件????????688??2004-12-28?00:00??留言板\images\face\face15.gif
............此處省略47個文件信息
評論
共有 條評論