您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->文件管理系统源码(Asp.net1.1)>>EditRole.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:文件管理系统源码(Asp.net1.1)
当前文件:文件类型 FileManageSys/EditRole.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Web; 7using System.Web.SessionState; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.HtmlControls; 11using System.Data.OleDb; 12namespace FileManage_Sys 13{ 14 /// <summary> 15 /// EditRole 的摘要说明。 16 /// </summary> 17 public class EditRole : System.Web.UI.Page 18 { 19 protected System.Web.UI.WebControls.TextBox role_name; 20 protected System.Web.UI.HtmlControls.HtmlSelect unSelectItems; 21 protected System.Web.UI.WebControls.Button delrole; 22 protected System.Web.UI.HtmlControls.HtmlSelect selectItems; 23 24 private void Page_Load(object sender, System.EventArgs e) 25 { 26 delrole.Attributes.Add("onclick","javascript :return confirm('你确定删除吗?')"); 27 if(!Page.IsPostBack) 28 { 29 string SqlStr="",Roleid; 30 Roleid = Request.QueryString["roleid"].ToString(); 31 string ConnectionStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ConnectionStr"].ToString());//从Web.config文件中获取数据库连接字符串 32 OleDbConnection AccessConnection = new OleDbConnection(ConnectionStr); 33 AccessConnection.Open();//打开数据库 34 35 SqlStr="Select * From Role Where id="+Roleid; 36 37 OleDbCommand AccessCommand = new OleDbCommand(SqlStr,AccessConnection); 38 39 OleDbDataReader AccessReader = AccessCommand.ExecuteReader(); 40 if(AccessReader.Read()) 41 { 42 role_name.Text = AccessReader["rolename"].ToString(); 43 44 } 45 AccessReader.Close(); 46 AccessCommand.Dispose(); 47 AccessConnection.Close(); 48 49 } 50 // 在此处放置用户代码以初始化页面 51 } 52 53 Web 窗体设计器生成的代码 74 75 private void delrole_Click(object sender, System.EventArgs e) 76 { 77 if( Request.QueryString["roleid"]==null) 78 { 79 Response.Write("<SCRIPT language='JavaScript'>alert('非法参数');window.location.href='RoleList.aspx';</SCRIPT>"); 80 } 81 else 82 { 83 string SqlStr="",Roleid; 84 Roleid = Request.QueryString["roleid"].ToString(); 85 string ConnectionStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source="+Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ConnectionStr"].ToString());//从Web.config文件中获取数据库连接字符串 86 OleDbConnection AccessConnection = new OleDbConnection(ConnectionStr); 87 AccessConnection.Open();//打开数据库 88 89 SqlStr="DELETE * From Role Where id="+Roleid; 90 91 OleDbCommand AccessCommand = new OleDbCommand(SqlStr,AccessConnection); 92 93 AccessCommand.ExecuteNonQuery(); 94 95 AccessCommand.Dispose(); 96 AccessConnection.Close(); 97 98 Response.Write("<SCRIPT language='JavaScript'>alert('删除成功');window.location.href='RoleList.aspx';</SCRIPT>"); 99 } 100 101 } 102 } 103} 104
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:文件管理系统源码(Asp.net1.1)
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号