温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:缤纷企业管理系统源码
当前文件:
BinFenEnterpriseWeb/Admin/AddEdit_About.aspx.cs[2K,2009-6-12 11:33:51],打开代码结构图
BinFenEnterpriseWeb/Admin/AddEdit_About.aspx.cs[2K,2009-6-12 11:33:51],打开代码结构图1using System; 2
using System.Data; 3
using System.IO; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
namespace Web.Admin 13
{ 14
public partial class AddEdit_About : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
19
if (!IsPostBack) 20
{ 21
CommFun.IsAdmin(); 22
23
if (Request.QueryString["Action"] == "Edit") 24
{ 25
DataRow drw = DBFun.GetDataRow("Select * From T_About where id=" + Request.QueryString["id"]); 26
if (drw == null) 27
{ 28
Response.Write("读取数据失败!数据库中没有此记录或参数不正确!"); 29
Response.End(); 30
} 31
tb_title.Text = drw["AboutType"].ToString(); 32
ftb_Contents.Text = drw["contents"].ToString(); 33
btn_Ok.Text = "修改"; 34
lbl_title.Text = "修改关于我们"; 35
} 36
} 37
38
} 39
40
41
42
protected void btn_Ok_Click(object sender, EventArgs e) 43
{ 44
//添加 45
46
string strsql; 47
if (btn_Ok.Text == "添加") 48
{ 49
strsql = string.Format("insert Into T_About (AboutType,contents) values ('{0}','{1}')", 50
tb_title.Text, ftb_Contents.Text.Replace("'", "''")); 51
52
if (DBFun.ExecuteUpdate(strsql)) 53
{ 54
string NewID = DBFun.SearchValue("select Max(ID) from T_About"); 55
Response.Write("<script>alert('添加成功!');window.location.href='AddEdit_About.aspx?Action=Edit&ID=" + NewID + "';</script>"); 56
} 57
} 58
else 59
{ 60
strsql = string.Format("Update T_About Set Abouttype='{0}',contents='{1}' where id={2}", 61
tb_title.Text, ftb_Contents.Text.Replace("'", "''"), Request.QueryString["id"]); 62
63
if (DBFun.ExecuteUpdate(strsql)) 64
{ 65
Response.Write("<script>alert('修改成功!');</script>"); 66
} 67
} 68
69
} 70
71
} 72
}






}
}