温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:达达ASP.NET简单新闻发布源码
当前文件路径:DaDaNews/Admin/EditClass.aspx.cs

1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Data.SqlClient; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.HtmlControls; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.WebControls.WebParts; 12
//该源码下载自www.51aspx.com(51aspx.com) 13
14
public partial class EditClass : System.Web.UI.Page 15
{ 16
Db pn163 = new Db(); 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
if (Session["Admin"] == null) 20
{ 21
Response.Redirect("Default.aspx"); 22
} 23
if (!IsPostBack) 24
{ 25
SqlConnection Conn = new SqlConnection(pn163.strConn); 26
27
Conn.Open(); 28
29
SqlCommand Cmd = new SqlCommand("select * from NewClass where id =" 30
+ Request.QueryString["id"], Conn); 31
32
SqlDataReader Dr = Cmd.ExecuteReader(); 33
34
35
if (Dr.Read()) 36
{ 37
TextBox1.Text = Dr["Class"].ToString(); 38
TextBox2.Text = Dr["St"].ToString(); 39
} 40
Conn.Close(); 41
} 42
} 43
//5_1_a_s_p_x.c_o_m 44
protected void Button1_Click(object sender, EventArgs e) 45
{ 46
string ClassNew = TextBox1.Text; 47
48
string ClassSt = TextBox2.Text; 49
50
SqlConnection Conn = new SqlConnection(pn163.strConn); 51
52
Conn.Open(); 53
54
SqlCommand Cmd = new SqlCommand("update NewClass set Class='"+ClassNew+"',St='"+ClassSt+ 55
"' where id ="+Request.QueryString["id"], Conn); 56
57
Cmd.ExecuteNonQuery(); 58
59
Conn.Close(); 60
Response.Redirect("./Class.aspx"); 61
} 62
} 63




Db pn163 
}
}