您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->库存管理系统V1.0源码>>Edithuo.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:库存管理系统V1.0源码
当前文件:文件类型 StoreManage/Edithuo.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 Edithuo : System.Web.UI.Page 14{ 15 private readonly string SqlConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString(); 16 private string BID; 17 private int strID 18 { 19 get 20 { 21 return Convert.ToInt32(ViewState["_BID"]); 22 } 23 set 24 { 25 ViewState["_BID"] = Request.QueryString["BID"]; 26 } 27 } 28 protected void Page_Load(object sender, EventArgs e) 29 { 30 if (!IsPostBack) 31 { 32 BID = Request["BID"].ToString(); 33 BindData(BID); 34 } 35 } 36 private void BindData(string BID) 37 { 38 string sqlstr; 39 sqlstr = "select * from huopin where huoID='" + BID + "'"; 40 SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); 41 SqlCommand scm = new SqlCommand(sqlstr, scon); 42 //打开数据库并执行查询操作 43 scon.Open(); 44 SqlDataReader dr = scm.ExecuteReader(); 45 if (dr.Read()) 46 { //rukuDate,rukuBianma,huoName,shuliang,jinjia,zhonge,beizhu,ghdw,jingbanren 47 this.TextBox1.Text = dr["huoName"].ToString(); 48 this.TextBox2.Text = dr["bianma"].ToString(); 49 this.TextBox3.Text = dr["huoDanwei"].ToString(); 50 this.DropDownList1.Text = dr["cfck"].ToString(); 51 //this.DropDownList2.Text = dr["jingbanren"].ToString(); 52 this.TextBox5.Text = dr["rkdw"].ToString(); 53 this.TextBox6.Text = dr["ckdw"].ToString(); 54 this.TextBox7.Text = dr["yskc"].ToString(); 55 this.TextBox8.Text = dr["dixian"].ToString(); 56 this.TextBox9.Text = dr["gaoxian"].ToString(); 57 58 } 59 //关闭数据库的连接 60 dr.Close(); 61 scon.Close(); 62 } 63 private bool kong() 64 { 65 if (this.TextBox1.Text == "") 66 { 67 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 68 return false; 69 } 70 else 71 { 72 if (this.TextBox2.Text == "") 73 { 74 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 75 return false; 76 } 77 else 78 { 79 if (this.TextBox3.Text == "") 80 { 81 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 82 return false; 83 } 84 85 else 86 { 87 if (this.TextBox5.Text == "") 88 { 89 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 90 return false; 91 } 92 else 93 { 94 if (this.TextBox6.Text == "") 95 { 96 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 97 return false; 98 } 99 else 100 { 101 if (this.TextBox7.Text == "") 102 { 103 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 104 return false; 105 } 106 else 107 { 108 if (this.TextBox8.Text == "") 109 { 110 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 111 return false; 112 } 113 else 114 { 115 if (this.TextBox9.Text == "") 116 { 117 Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 118 return false; 119 } 120 else 121 { 122 return true; 123 } 124 } 125 } 126 } 127 128 } 129 } 130 } 131 } 132 } 133 protected void Button1_Click(object sender, EventArgs e) 134 { 135 if (kong()) 136 { 137 //定义变量 138 string bbb = Request.QueryString["BID"]; 139 string aa, bb, cc, dd, ee, ff, gg, hh, ii; 140 aa = this.TextBox1.Text; 141 bb = this.TextBox2.Text; 142 cc = this.TextBox3.Text; 143 dd = this.DropDownList1.Text; 144 ee = this.TextBox5.Text; 145 ff = this.TextBox6.Text; 146 gg = this.TextBox7.Text; 147 hh = this.TextBox8.Text; 148 ii = this.TextBox9.Text; 149 SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); 150 scon.Open(); 151 152 //SqlCommand scmd = new SqlCommand("insert into Notice(Title,Content,Note,entertime) values ('" + name + "','" + word + "','" + bz + "','" + intime + "')", scon); 153 SqlCommand scmd = new SqlCommand("update huopin set huoName='" + aa + "',bianma='" + bb + "',huoDanwei='" + cc + "',cfck='" + dd + "',rkdw='" + ee + "',ckdw='" + ff + "',yskc='" + gg + "',dixian='" + hh + "',gaoxian='" + ii + "' where huoID='" + bbb + "'", scon); 154 scmd.ExecuteNonQuery(); 155 scmd.Dispose(); 156 scon.Close(); 157 Response.Write("<script language='javascript'>alert('更新成功!');</script>"); 158 Server.Transfer("Managehuo.aspx"); 159 } 160 } 161 protected void Button2_Click(object sender, EventArgs e) 162 { 163 Server.Transfer("Managehuo.aspx"); 164 } 165} 166
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:库存管理系统V1.0源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号