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