温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:达达ASP.NET企业信息管理系统
当前文件路径:DaDaEnterprise/Admin/Admin_EditClass.aspx.cs

1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.HtmlControls; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
12
public partial class Admin_Admin_EditClass : System.Web.UI.Page 13
{ 14
protected void Page_Load(object sender, EventArgs e) 15
{ 16
DataAccess.IsAdmin(); 17
string sql = "select * from [Class] where id=" + Request.QueryString["id"]; 18
DataTable Dt = DataAccess.GetDataTable(sql); 19
if (!IsPostBack) 20
{ 21
TextBox1.Text = Dt.Rows[0]["ClsName"].ToString(); 22
TextBox2.Text = Dt.Rows[0]["Sort"].ToString(); 23
} 24
} 25
26
protected void Sub_Click(object sender, EventArgs e) 27
{ 28
string sql = "update [Class] set ClsName='" 29
+ TextBox1.Text + "',Sort='" 30
+ TextBox2.Text + "'"; 31
if (!String.IsNullOrEmpty(TextBox1.Text) && !String.IsNullOrEmpty(TextBox2.Text)) 32
{ 33
if (DataAccess.ExecuteCmd(sql) > 0) 34
{ 35
Response.Redirect("./Admin_Class.aspx"); 36
} 37
Response.Write("<script>alert('编辑失败!');</script>"); 38
} 39
Response.Write("<script>alert('不能提交空值!');</script>"); 40
} 41
} 42





}
}