温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:库存管理系统V1.0源码
当前文件:
StoreManage/Addpancun.aspx.cs,打开代码结构图
StoreManage/Addpancun.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class Addpancun : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
18
} 19
protected void Button1_Click(object sender, EventArgs e) 20
{ 21
if(kong()) 22
{ 23
string aa, bb, cc, dd, ee; 24
aa = this.TextBox1.Text; 25
bb = this.TextBox2.Text; 26
cc = this.TextBox3.Text; 27
dd = this.TextBox4.Text; 28
ee = this.DropDownList1.Text; 29
SqlConnection scon = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]); 30
scon.Open(); 31
SqlCommand scmd = new SqlCommand("insert into pancun(huoName,bianma,huoDanwei,cfck,pancun) values ('" + aa + "','" + bb + "','" + cc + "','" + ee + "','" + dd + "')", scon); 32
scmd.ExecuteNonQuery(); 33
scmd.Dispose(); 34
scon.Close(); 35
Response.Write("<script language='javascript'>alert('添加成功!');</script>"); 36
Server.Transfer("Managepancun.aspx"); 37
} 38
} 39
protected void Button2_Click(object sender, EventArgs e) 40
{ 41
Server.Transfer("Managepancun.aspx"); 42
} 43
private bool kong() 44
{ 45
if (this.TextBox1.Text == "") 46
{ 47
Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 48
return false; 49
} 50
else 51
{ 52
if (this.TextBox2.Text == "") 53
{ 54
Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 55
return false; 56
} 57
else 58
{ 59
if (this.TextBox3.Text == "") 60
{ 61
Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 62
return false; 63
} 64
else 65
{ 66
if (this.TextBox4.Text == "") 67
{ 68
Response.Write("<script language='javascript'>alert('其他不能为空!');</script>"); 69
return false; 70
} 71
else 72
{ 73
return true; 74
} 75
} 76
} 77
} 78
} 79
} 80





}
}