Asp.net源码专业站
首页->留言本类->小白留言板源码>>messagereplay.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小白留言板源码
当前文件:文件类型 XiaobaiLiuyanban/messagereplay.aspx.cs[2K,2009-6-12 11:59:24]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13public partial class messagereplay : System.Web.UI.Page 14{ 15 protected void Page_Load(object sender, EventArgs e) 16 { 17 if (Session["name"] == null) 18 { 19 Response.Redirect("Login.aspx"); 20 } 21 if (!Page.IsPostBack) 22 { 23 showmessage(); 24 } 25 } 26 private void showmessage() 27 { 28 try 29 { 30 string m_id = Request["m_id"].ToString(); 31 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["getcon"].ConnectionString); 32 con.Open(); 33 string sql = "select * from message where m_id='" + m_id + "'"; 34 SqlCommand com = new SqlCommand(sql, con); 35 SqlDataReader dr = com.ExecuteReader(); 36 if (dr.Read()) 37 { 38 this.labname.Text = dr["m_name"].ToString(); 39 this.labsubject.Text = dr["m_subject"].ToString(); 40 this.labcontent.Text = dr["m_content"].ToString(); 41 this.trepaly.Text = dr["m_replay"].ToString(); 42 } 43 dr.Close(); 44 con.Close(); 45 } 46 catch (Exception) 47 { 48 49 Response.Redirect("showmessage.aspx"); 50 } 51 52 } 53 protected void btnreplay_Click(object sender, EventArgs e) 54 { 55 string m_id = Request["m_id"].ToString(); 56 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["getcon"].ConnectionString); 57 con.Open(); 58 string sql = "update message set m_replay=@replay,m_replaytime=@datetime where m_id='" + m_id + "'"; 59 SqlCommand com = new SqlCommand(sql, con); 60 com.Parameters.Add("@replay", SqlDbType.Text).Value = this.trepaly.Text.ToString(); 61 com.Parameters.Add("@datetime", SqlDbType.DateTime).Value = DateTime.Now.ToString(); 62 try 63 { 64 com.ExecuteNonQuery(); 65 Response.Write("<script>alert('回复成功!')</script>"); 66 } 67 catch (Exception ex) 68 { 69 throw new System.Exception(ex.Message); 70 71 } 72 finally 73 { 74 con.Close(); 75 } 76 } 77 protected void btncan_Click(object sender, EventArgs e) 78 { 79 Response.Redirect("showmessage.aspx"); 80 } 81} 82
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:小白留言板源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146