您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->库存管理系统V1.0源码>>Editghdw.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:库存管理系统V1.0源码
当前文件:文件类型 StoreManage/Editghdw.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; 12public partial class Editghdw : System.Web.UI.Page 13{ 14 private readonly string SqlConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString(); 15 private string BID; 16 private int strID 17 { 18 get 19 { 20 return Convert.ToInt32(ViewState["_BID"]); 21 } 22 set 23 { 24 ViewState["_BID"] = Request.QueryString["BID"]; 25 } 26 } 27 protected void Page_Load(object sender, EventArgs e) 28 { 29 if (!IsPostBack) 30 { 31 BID = Request["BID"].ToString(); 32 BindData(BID); 33 } 34 } 35 private void BindData(string BID) 36 { 37 string sqlstr; 38 sqlstr = "select * from ghdw where gongID='" + BID + "'"; 39 SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); 40 SqlCommand scm = new SqlCommand(sqlstr, scon); 41 //打开数据库并执行查询操作 42 scon.Open(); 43 SqlDataReader dr = scm.ExecuteReader(); 44 if (dr.Read()) 45 { 46 this.TextBox1.Text = dr["Bianma"].ToString(); 47 this.TextBox2.Text = dr["Name"].ToString(); 48 this.TextBox3.Text = dr["Address"].ToString(); 49 this.TextBox4.Text = dr["tel"].ToString(); 50 this.TextBox5.Text = dr["person"].ToString(); 51 } 52 //关闭数据库的连接 53 dr.Close(); 54 scon.Close(); 55 } 56 protected void Button1_Click(object sender, EventArgs e) 57 { 58 if (kong()) 59 { 60 //定义变量 61 string bbb = Request.QueryString["BID"]; 62 string aa, bb, cc,dd,ee; 63 aa = this.TextBox1.Text; 64 bb = this.TextBox2.Text; 65 cc = this.TextBox3.Text; 66 dd = this.TextBox4.Text; 67 ee = this.TextBox5.Text; 68 SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); 69 scon.Open(); 70 SqlCommand scmd = new SqlCommand("update ghdw set Bianma='" + aa + "',Address='" + cc + "',Name='" + bb + "',person='" + ee + "',tel='" + dd + "' where gongID='" + bbb + "'", scon); 71 scmd.ExecuteNonQuery(); 72 scmd.Dispose(); 73 scon.Close(); 74 Response.Write("<script language='javascript'>alert('修改成功!');</script>"); 75 Server.Transfer("manageghdw.aspx"); 76 } 77 } 78 private bool kong() 79 { 80 if (this.TextBox1.Text == "") 81 { 82 Response.Write("<script language='javascript'>alert('单位编码不能为空!');</script>"); 83 return false; 84 } 85 else 86 { 87 if (this.TextBox2.Text == "") 88 { 89 Response.Write("<script language='javascript'>alert('单位名称不能为空!');</script>"); 90 return false; 91 } 92 else 93 { 94 return true; 95 } 96 } 97 } 98 protected void Button2_Click(object sender, EventArgs e) 99 { 100 Server.Transfer("manageghdw.aspx"); 101 } 102} 103 104
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:库存管理系统V1.0源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号