温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.Net许愿墙系统源码
当前文件路径:XuYuanQiang/Input.aspx.cs

1using System; 2
using System.Collections; 3
using System.ComponentModel; 4
using System.Data; 5
using System.Data.OleDb; 6
using System.Drawing; 7
using System.Web; 8
using System.Web.SessionState; 9
using System.Web.UI; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.HtmlControls; 12
using System.Text; 13
14
namespace pizi 15
{ 16
/// <summary> 17
/// Summary description for Input. 18
/// </summary> 19
public partial class Input : System.Web.UI.Page 20
{ 21
protected Encoding encod = null; 22
23
protected void Page_Load(object sender, System.EventArgs e) 24
{ 25
26
this.B(); 27
28
} 29
public void B() 30
{ 31
if(Request["author"] ==null || Request["tagbcolor"]==null || Request["massages"]==null) 32
{ 33
Response.End(); 34
} 35
encod = Encoding.GetEncoding("GB2312"); 36
string cauthor = Request["author"].ToString(); 37
string cbcolor = Request["tagbcolor"].ToString(); 38
string ccontent = Request["massages"].ToString(); 39
string md5id = Session["md5id"].ToString(); 40
41
if(ccontent.Length>100) 42
{ 43
ccontent = ccontent.Substring(0,100); 44
} 45
string Constr ="Provider=Microsoft.Jet.OLeDb.4.0;Data source=" + Server.MapPath("Love_Dai.mdb"); 46
//string Querystring ="Insert Into ccc_love(cauthor,ccontent,cbcolor) values ( @cauthor,@ccontent,@cbcolor)"; 47
string Querystring =" Update ccc_love set cauthor=@cauthor,ccontent=@ccontent,cbcolor=@cbcolor where md5id=@md5id "; 48
OleDbConnection oleconnection = new OleDbConnection(Constr); 49
OleDbCommand cmd = new OleDbCommand(Querystring,oleconnection); 50
cmd.Parameters.Add("@cauthor",OleDbType.VarChar,250); 51
cmd.Parameters.Add("@ccontent",OleDbType.VarChar,250); 52
cmd.Parameters.Add("@cbcolor",OleDbType.VarChar,50); 53
cmd.Parameters.Add("@md5id",OleDbType.VarChar,250); 54
cmd.Parameters["@cauthor"].Value = cauthor; 55
cmd.Parameters["@ccontent"].Value = ccontent; 56
cmd.Parameters["@cbcolor"].Value = cbcolor; 57
cmd.Parameters["@md5id"].Value = md5id; 58
59
try 60
{ 61
oleconnection.Open(); 62
cmd.ExecuteNonQuery(); 63
oleconnection.Close(); 64
cmd.Dispose(); 65
} 66
catch(Exception e) 67
{ 68
msgbox.Text = "错误是:" + e.ToString(); 69
} 70
71
72
//Response.Write("<script>alert('\n\n\n\n粘贴祝福纸条成功!!!\n\n\n返回首页查看祝福\n\n\n');location.href='index.aspx';;</script>"); 73
Response.Redirect("index.aspx"); 74
75
} 76
77
Web Form Designer generated code 96
} 97
} 98





}