温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小区物业管理系统源码
当前文件:
SmallHouse/admin/editfix.aspx.cs,打开代码结构图
SmallHouse/admin/editfix.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
14
public partial class admin_Default2 : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
if (!IsPostBack) 19
{ 20
if (Convert.ToString(Session["UID"]) == "") 21
{ 22
Response.Redirect("login.aspx"); 23
24
} 25
else 26
{ 27
this.bind(); 28
29
} 30
} 31
32
} 33
protected void bind() 34
{ 35
string ID = Request.QueryString["fixID"].ToString(); 36
string str = "select * from fixManager where fixID='" + ID + "'"; 37
38
BaseClass bc = new BaseClass(); 39
40
SqlDataReader sda = bc.ExecRead(str); 41
if (sda.Read()) 42
{ //绑定数据 43
name.Text = sda["name"].ToString(); 44
amount.Text = sda["amount"].ToString(); 45
factory.Text = sda["factory"].ToString(); 46
logoutdate.Text = sda["factoryDate"].ToString(); 47
48
49
50
51
} 52
53
} 54
55
protected void Button1_Click(object sender, EventArgs e) 56
{ 57
BaseClass bcc = new BaseClass(); 58
string ID = Request.QueryString["fixID"].ToString(); 59
60
string sqlstr = "update fixManager set name='" + name.Text + "',amount='" + amount.Text + "',factory='" + factory.Text + "',factoryDate='" + logoutdate.Text + "' where fixID='"+ID+"'" ; 61
//Response.Write(sqlstr); 62
//Response.End(); 63
64
if (bcc.ExecSql(sqlstr)) 65
{ 66
Response.Write("<script language=javascript>alert('修改设备信息成功!');opener.location='fix.aspx';window.close()</script>"); 67
68
} 69
else 70
{ 71
Response.Write("<script>alert('添加失败,请重试!');</script>"); 72
return; 73
} 74
75
} 76
protected void Button2_Click(object sender, EventArgs e) 77
{ 78
Response.Write("<script>window.close();</script>"); 79
} 80
81
} 82





}
}