您目前尚未登陆,请选择【登陆】或【注册
首页->上传下载->明日企业下载管理系统源码>>BackAdmin/SettleProject/UpdateSettleProject.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明日企业下载管理系统源码
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13public partial class BackAdmin_SettleProject_UpdateSettleProject : System.Web.UI.Page 14{ 15 CAN can = new CAN(); 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 //获取登录后台时所输入的用户名 19 TextBox1.Text = Session["Name"].ToString(); 20 //首次执行页面,通过DropDownList1控件将tb_regimentation表的Name字段显示出来 21 if (Page.IsPostBack == false) 22 { 23 this.TextBox3.Visible = false; 24 SqlConnection mycon = new SqlConnection("server=(local);user id=sa;PWD=sa;DataBase=db_ComPany"); 25 mycon.Open(); 26 SqlDataAdapter myada = new SqlDataAdapter("select * from tb_regimentation ORDER BY ID DESC", mycon); 27 DataSet myds = new DataSet(); 28 myada.Fill(myds); 29 DropDownList1.DataSource = myds; 30 DropDownList1.DataTextField = "Name"; 31 DropDownList1.DataValueField = "id"; 32 DropDownList1.DataBind(); 33 34 35 36 //通过上面获取来的登录用户名,检索tb_Administrator表中此用户的ID值 37 SqlCommand mycom = new SqlCommand("select id from tb_Administrator where Name='" + Session["Name"].ToString() + "'", mycon); 38 Session["userid"] = Convert.ToInt32(mycom.ExecuteScalar()); 39 mycon.Close(); 40 41 42 DataSet ds = null; 43 ds = can.GetDataSet("select * from SettView where ID=" + Request["ID"], "tb_SettleProject"); 44 //SqlConnection mycon2 = new SqlConnection("server=(local);user id=sa;PWD=sa;DataBase=db_ComPany"); 45 //mycon2.Open(); 46 //SqlDataAdapter myada2 = new SqlDataAdapter("select * from SettView where ID=" + Request["ID"], mycon2); 47 //DataSet ds = new DataSet(); 48 //myada2.Fill(ds, "tb_SettleProject"); 49 DataRowView rowview = ds.Tables["tb_SettleProject"].DefaultView[0]; 50 txtRegimentationname.Text = Convert.ToString(rowview["Name"]); 51 TextBox2.Text = Convert.ToString(rowview["content"]); 52 } 53 } 54 protected void btninsert_Click(object sender, EventArgs e) 55 { 56 //-------------------------------------------------------------------------------------------------------------- 57 // 执行文件上传至服务器 58 string filePath = "", fileExtName = "", mFileName, mPath; 59 if ("" != this.File1.PostedFile.FileName) 60 { 61 filePath = File1.PostedFile.FileName; 62 fileExtName = filePath.Substring(filePath.LastIndexOf(".") + 1); 63 try 64 { 65 mPath = Server.MapPath("../../SettTmg/"); 66 mFileName = filePath.Substring(filePath.LastIndexOf("\\") + 1); 67 File1.PostedFile.SaveAs(mPath + mFileName); 68 TextBox3.Text = "SettTmg/" + mFileName; 69 //TextBox3.Text = mFileName;//只将文件名存入数据库中 70 File1.Visible = false; 71 TextBox3.Visible = true; 72 } 73 catch (Exception err) 74 { 75 Response.Write(err.ToString()); 76 } 77 } 78 //--------------------------------------------------------------------------------------------------------------- 79 can.ExecSqlCom("update tb_SettleProject set Name='" + txtRegimentationname.Text + "',regimentationID='" + DropDownList1.Text + "',person='" + Session["userid"].ToString() + "',img='" + TextBox3.Text + "',content='" + TextBox2.Text + "' where ID=" + Request["ID"]); 80 //Response.Write("<script lanuage=javascript>alert('修改成功!');location='javascript:history.go(-1)'</script>"); 81 Response.Write("<script lanuage=javascript>alert('修改成功!');location='SettleProject.aspx'</script>"); 82 } 83 protected void Button1_Click(object sender, EventArgs e) 84 { 85 Page.Response.Redirect("SettleProject.aspx"); 86 } 87} 88
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:明日企业下载管理系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号