<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
< HTML >
< HEAD >
< title > lanchudengji </ title >
< meta content ="Microsoft Visual Studio .NET 7.1" name ="GENERATOR" >
< meta content ="C#" name ="CODE_LANGUAGE" >
< meta content ="JavaScript" name ="vs_defaultClientScript" >
< meta content ="http://schemas.microsoft.com/intellisense/ie5" name ="vs_targetSchema" >
< style type ="text/css" > BODY {}{ BACKGROUND-COLOR: #def3ff }
</ style >
</ HEAD >
< body MS_POSITIONING ="GridLayout" >
< form id ="Form1" method ="post" runat ="server" >
< FONT face ="宋体" >
< asp:label id ="Label1" style ="Z-INDEX: 101; LEFT: 168px; POSITION: absolute; TOP: 56px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 职工姓名: </ asp:label >< asp:label id ="Label2" style ="Z-INDEX: 102; LEFT: 168px; POSITION: absolute; TOP: 88px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 所属部门: </ asp:label >< asp:dropdownlist id ="DropDownList1" style ="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 88px"
tabIndex ="2" runat ="server" ></ asp:dropdownlist >< asp:label id ="Label3" style ="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 120px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储帐号: </ asp:label >< asp:textbox id ="TextBox2" style ="Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 120px"
tabIndex ="3" runat ="server" BorderStyle ="Groove" ToolTip ="活期帐号应该为19位" ></ asp:textbox >< asp:label id ="Label4" style ="Z-INDEX: 106; LEFT: 168px; POSITION: absolute; TOP: 152px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储金额: </ asp:label >< asp:textbox id ="TextBox3" style ="Z-INDEX: 107; LEFT: 248px; POSITION: absolute; TOP: 152px"
tabIndex ="4" runat ="server" BorderStyle ="Groove" ToolTip ="金额为非零开头的正数" ></ asp:textbox >< asp:label id ="Label5" style ="Z-INDEX: 108; LEFT: 168px; POSITION: absolute; TOP: 184px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储类型: </ asp:label >< asp:dropdownlist id ="DropDownList2" style ="Z-INDEX: 109; LEFT: 248px; POSITION: absolute; TOP: 184px"
tabIndex ="5" runat ="server" >
< asp:ListItem Value ="活期" > 活期 </ asp:ListItem >
</ asp:dropdownlist >< asp:label id ="Label6" style ="Z-INDEX: 110; LEFT: 168px; POSITION: absolute; TOP: 216px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 客户类型: </ asp:label >< asp:dropdownlist id ="DropDownList3" style ="Z-INDEX: 111; LEFT: 248px; POSITION: absolute; TOP: 216px"
tabIndex ="6" runat ="server" BorderStyle ="Groove" Height ="16px" ></ asp:dropdownlist >< asp:label id ="Label7" style ="Z-INDEX: 112; LEFT: 168px; POSITION: absolute; TOP: 248px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" Height ="8px" > 存入日期: </ asp:label >< asp:textbox id ="TextBox4" style ="Z-INDEX: 113; LEFT: 248px; POSITION: absolute; TOP: 248px"
tabIndex ="7" runat ="server" BorderStyle ="Groove" ToolTip ="格式:050101" ></ asp:textbox >< asp:button id ="Button1" style ="Z-INDEX: 114; LEFT: 248px; POSITION: absolute; TOP: 288px" tabIndex ="8"
runat ="server" BorderStyle ="Groove" Text ="确 认" ></ asp:button >< asp:requiredfieldvalidator id ="RequiredFieldValidator1" style ="Z-INDEX: 115; LEFT: 416px; POSITION: absolute; TOP: 120px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入揽储帐号" ControlToValidate ="TextBox2" ></ asp:requiredfieldvalidator >< asp:requiredfieldvalidator id ="RequiredFieldValidator2" style ="Z-INDEX: 116; LEFT: 416px; POSITION: absolute; TOP: 152px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入揽储金额" ControlToValidate ="TextBox3" ></ asp:requiredfieldvalidator >< asp:requiredfieldvalidator id ="RequiredFieldValidator3" style ="Z-INDEX: 117; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入日期" ControlToValidate ="TextBox4" ></ asp:requiredfieldvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator1" style ="Z-INDEX: 118; LEFT: 416px; POSITION: absolute; TOP: 128px"
runat ="server" Font-Size ="Smaller" ToolTip ="活期帐号应为18位数字" ErrorMessage ="活期帐号应为18位数字" ControlToValidate ="TextBox2" ValidationExpression ="^\d{18}$" ></ asp:regularexpressionvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator3" style ="Z-INDEX: 119; LEFT: 416px; POSITION: absolute; TOP: 160px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="只能输入正数,可以带2位小数" ControlToValidate ="TextBox3" ValidationExpression ="^[0-9]+(.[0-9]{2})?$" ></ asp:regularexpressionvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator2" style ="Z-INDEX: 120; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="时间格式应该为“年月日”(如050101),并且月<=12,日<=31" ControlToValidate ="TextBox4" ValidationExpression ="^(\d{2})((0?[1-9])|(1[0-2]))((0?[1-9])|((1|2)[0-9])|30|31)$" ></ asp:regularexpressionvalidator >
< asp:RegularExpressionValidator id ="RegularExpressionValidator4" style ="Z-INDEX: 121; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="时间格式应该为“年月日”(如050101),并且月<=12,日<=31" ControlToValidate ="TextBox4"
ValidationExpression ="\d{6}$" ></ asp:RegularExpressionValidator >
< asp:TextBox id ="TextBox5" style ="Z-INDEX: 122; LEFT: 248px; POSITION: absolute; TOP: 24px" runat ="server"
BorderStyle ="Groove" AutoPostBack ="True" ></ asp:TextBox >
< asp:DropDownList id ="DropDownList4" style ="Z-INDEX: 123; LEFT: 248px; POSITION: absolute; TOP: 56px"
runat ="server" tabIndex ="1" ></ asp:DropDownList >
< asp:Label id ="Label8" style ="Z-INDEX: 124; LEFT: 168px; POSITION: absolute; TOP: 24px" runat ="server"
ForeColor ="#004040" Font-Size ="Smaller" > 职工编号: </ asp:Label >
< asp:Button id ="Button2" style ="Z-INDEX: 125; LEFT: 416px; POSITION: absolute; TOP: 24px" runat ="server"
Text ="Button" ></ asp:Button ></ FONT ></ form >
< script language ="javascript" for ="document" event ="onkeydown" >
<!--
if(event.keyCode==13 && event.srcElement.type!='button' && event.srcElement.type!='submit' && event.srcElement.type!='reset' && event.srcElement.type!='')
event.keyCode=9;
-->
</ script >
</ body >
</ HTML >
< HTML >
< HEAD >
< title > lanchudengji </ title >
< meta content ="Microsoft Visual Studio .NET 7.1" name ="GENERATOR" >
< meta content ="C#" name ="CODE_LANGUAGE" >
< meta content ="JavaScript" name ="vs_defaultClientScript" >
< meta content ="http://schemas.microsoft.com/intellisense/ie5" name ="vs_targetSchema" >
< style type ="text/css" > BODY {}{ BACKGROUND-COLOR: #def3ff }
</ style >
</ HEAD >
< body MS_POSITIONING ="GridLayout" >
< form id ="Form1" method ="post" runat ="server" >
< FONT face ="宋体" >
< asp:label id ="Label1" style ="Z-INDEX: 101; LEFT: 168px; POSITION: absolute; TOP: 56px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 职工姓名: </ asp:label >< asp:label id ="Label2" style ="Z-INDEX: 102; LEFT: 168px; POSITION: absolute; TOP: 88px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 所属部门: </ asp:label >< asp:dropdownlist id ="DropDownList1" style ="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 88px"
tabIndex ="2" runat ="server" ></ asp:dropdownlist >< asp:label id ="Label3" style ="Z-INDEX: 104; LEFT: 168px; POSITION: absolute; TOP: 120px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储帐号: </ asp:label >< asp:textbox id ="TextBox2" style ="Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 120px"
tabIndex ="3" runat ="server" BorderStyle ="Groove" ToolTip ="活期帐号应该为19位" ></ asp:textbox >< asp:label id ="Label4" style ="Z-INDEX: 106; LEFT: 168px; POSITION: absolute; TOP: 152px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储金额: </ asp:label >< asp:textbox id ="TextBox3" style ="Z-INDEX: 107; LEFT: 248px; POSITION: absolute; TOP: 152px"
tabIndex ="4" runat ="server" BorderStyle ="Groove" ToolTip ="金额为非零开头的正数" ></ asp:textbox >< asp:label id ="Label5" style ="Z-INDEX: 108; LEFT: 168px; POSITION: absolute; TOP: 184px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 揽储类型: </ asp:label >< asp:dropdownlist id ="DropDownList2" style ="Z-INDEX: 109; LEFT: 248px; POSITION: absolute; TOP: 184px"
tabIndex ="5" runat ="server" >
< asp:ListItem Value ="活期" > 活期 </ asp:ListItem >
</ asp:dropdownlist >< asp:label id ="Label6" style ="Z-INDEX: 110; LEFT: 168px; POSITION: absolute; TOP: 216px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" > 客户类型: </ asp:label >< asp:dropdownlist id ="DropDownList3" style ="Z-INDEX: 111; LEFT: 248px; POSITION: absolute; TOP: 216px"
tabIndex ="6" runat ="server" BorderStyle ="Groove" Height ="16px" ></ asp:dropdownlist >< asp:label id ="Label7" style ="Z-INDEX: 112; LEFT: 168px; POSITION: absolute; TOP: 248px" runat ="server"
Font-Size ="Smaller" ForeColor ="#004040" Height ="8px" > 存入日期: </ asp:label >< asp:textbox id ="TextBox4" style ="Z-INDEX: 113; LEFT: 248px; POSITION: absolute; TOP: 248px"
tabIndex ="7" runat ="server" BorderStyle ="Groove" ToolTip ="格式:050101" ></ asp:textbox >< asp:button id ="Button1" style ="Z-INDEX: 114; LEFT: 248px; POSITION: absolute; TOP: 288px" tabIndex ="8"
runat ="server" BorderStyle ="Groove" Text ="确 认" ></ asp:button >< asp:requiredfieldvalidator id ="RequiredFieldValidator1" style ="Z-INDEX: 115; LEFT: 416px; POSITION: absolute; TOP: 120px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入揽储帐号" ControlToValidate ="TextBox2" ></ asp:requiredfieldvalidator >< asp:requiredfieldvalidator id ="RequiredFieldValidator2" style ="Z-INDEX: 116; LEFT: 416px; POSITION: absolute; TOP: 152px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入揽储金额" ControlToValidate ="TextBox3" ></ asp:requiredfieldvalidator >< asp:requiredfieldvalidator id ="RequiredFieldValidator3" style ="Z-INDEX: 117; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="请输入日期" ControlToValidate ="TextBox4" ></ asp:requiredfieldvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator1" style ="Z-INDEX: 118; LEFT: 416px; POSITION: absolute; TOP: 128px"
runat ="server" Font-Size ="Smaller" ToolTip ="活期帐号应为18位数字" ErrorMessage ="活期帐号应为18位数字" ControlToValidate ="TextBox2" ValidationExpression ="^\d{18}$" ></ asp:regularexpressionvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator3" style ="Z-INDEX: 119; LEFT: 416px; POSITION: absolute; TOP: 160px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="只能输入正数,可以带2位小数" ControlToValidate ="TextBox3" ValidationExpression ="^[0-9]+(.[0-9]{2})?$" ></ asp:regularexpressionvalidator >< asp:regularexpressionvalidator id ="RegularExpressionValidator2" style ="Z-INDEX: 120; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="时间格式应该为“年月日”(如050101),并且月<=12,日<=31" ControlToValidate ="TextBox4" ValidationExpression ="^(\d{2})((0?[1-9])|(1[0-2]))((0?[1-9])|((1|2)[0-9])|30|31)$" ></ asp:regularexpressionvalidator >
< asp:RegularExpressionValidator id ="RegularExpressionValidator4" style ="Z-INDEX: 121; LEFT: 416px; POSITION: absolute; TOP: 248px"
runat ="server" Font-Size ="Smaller" ErrorMessage ="时间格式应该为“年月日”(如050101),并且月<=12,日<=31" ControlToValidate ="TextBox4"
ValidationExpression ="\d{6}$" ></ asp:RegularExpressionValidator >
< asp:TextBox id ="TextBox5" style ="Z-INDEX: 122; LEFT: 248px; POSITION: absolute; TOP: 24px" runat ="server"
BorderStyle ="Groove" AutoPostBack ="True" ></ asp:TextBox >
< asp:DropDownList id ="DropDownList4" style ="Z-INDEX: 123; LEFT: 248px; POSITION: absolute; TOP: 56px"
runat ="server" tabIndex ="1" ></ asp:DropDownList >
< asp:Label id ="Label8" style ="Z-INDEX: 124; LEFT: 168px; POSITION: absolute; TOP: 24px" runat ="server"
ForeColor ="#004040" Font-Size ="Smaller" > 职工编号: </ asp:Label >
< asp:Button id ="Button2" style ="Z-INDEX: 125; LEFT: 416px; POSITION: absolute; TOP: 24px" runat ="server"
Text ="Button" ></ asp:Button ></ FONT ></ form >
< script language ="javascript" for ="document" event ="onkeydown" >
<!--
if(event.keyCode==13 && event.srcElement.type!='button' && event.srcElement.type!='submit' && event.srcElement.type!='reset' && event.srcElement.type!='')
event.keyCode=9;
-->
</ script >
</ body >
</ HTML >
后台代码
using
System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace lanchuxitong
{
/**//// <summary>
/// lanchudengji 的摘要说明。
/// </summary>
public class huoqiluru : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.DropDownList DropDownList2;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.DropDownList DropDownList3;
protected System.Web.UI.WebControls.TextBox TextBox4;
protected System.Web.UI.WebControls.Button Button1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Web.UI.WebControls.DropDownList DropDownList4;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter3;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand3;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand3;
protected System.Data.SqlClient.SqlConnection sqlConnection2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator3;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator4;
protected System.Web.UI.WebControls.TextBox TextBox5;
protected System.Web.UI.WebControls.Label Label8;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand2;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand2;
protected System.Data.SqlClient.SqlConnection sqlConnection3;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label7;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(HttpContext.Current.User.IsInRole("registrar")==false)
{
Response.ClearContent();
Response.ClearHeaders();
Response.Write("您没有权限执行该操作!");
Response.Flush();
Response.Close();
}
/**//*if(!this.IsPostBack)
{
TextBox5.Text=DateTime.Now.ToString("yyyy-MM-dd");
}*/
if(!this.IsPostBack)
{
zjmDataBind();
}
}
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDataAdapter3 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlInsertCommand3 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection2 = new System.Data.SqlClient.SqlConnection();
this.sqlSelectCommand3 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection3 = new System.Data.SqlClient.SqlConnection();
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
this.sqlConnection1.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(this.sqlConnection1_InfoMessage);
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "bumenxinxi", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("bumenbianma", "bumenbianma"),
new System.Data.Common.DataColumnMapping("bumenmingcheng", "bumenmingcheng")})});
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO bumenxinxi(bumenbianma, bumenmingcheng) VALUES (@bumenbianma, @bumenm" +
"ingcheng); SELECT bumenbianma, bumenmingcheng FROM bumenxinxi";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bumenbianma", System.Data.SqlDbType.VarChar, 10, "bumenbianma"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bumenmingcheng", System.Data.SqlDbType.NVarChar, 50, "bumenmingcheng"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT bumenbianma, bumenmingcheng FROM bumenxinxi";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "zhigongxinxi", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("zhigongbianma", "zhigongbianma"),
new System.Data.Common.DataColumnMapping("zhigongxingming", "zhigongxingming")})});
//
// sqlDataAdapter3
//
this.sqlDataAdapter3.InsertCommand = this.sqlInsertCommand3;
this.sqlDataAdapter3.SelectCommand = this.sqlSelectCommand3;
this.sqlDataAdapter3.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "kehuleixing", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("bianma", "bianma"),
new System.Data.Common.DataColumnMapping("kehuleixing", "kehuleixing")})});
//
// sqlInsertCommand3
//
this.sqlInsertCommand3.CommandText = "INSERT INTO kehuleixing(bianma, kehuleixing) VALUES (@bianma, @kehuleixing); SELE" +
"CT bianma, kehuleixing FROM kehuleixing";
this.sqlInsertCommand3.Connection = this.sqlConnection2;
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bianma", System.Data.SqlDbType.VarChar, 10, "bianma"));
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@kehuleixing", System.Data.SqlDbType.NVarChar, 50, "kehuleixing"));
//
// sqlConnection2
//
this.sqlConnection2.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
//
// sqlSelectCommand3
//
this.sqlSelectCommand3.CommandText = "SELECT bianma, kehuleixing FROM kehuleixing";
this.sqlSelectCommand3.Connection = this.sqlConnection2;
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT zhigongbianma, zhigongxingming FROM zhigongxinxi ORDER BY zhigongxingming";
this.sqlSelectCommand2.Connection = this.sqlConnection3;
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO zhigongxinxi(zhigongxingming) VALUES (@zhigongxingming); SELECT zhigo" +
"ngbianma, zhigongxingming FROM zhigongxinxi ORDER BY zhigongxingming";
this.sqlInsertCommand2.Connection = this.sqlConnection3;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zhigongxingming", System.Data.SqlDbType.NVarChar, 20, "zhigongxingming"));
//
// sqlConnection3
//
this.sqlConnection3.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void sqlConnection1_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e)
{
}
private void zjmDataBind()
{
DataSet dsLanChu = new DataSet();
sqlDataAdapter1.Fill(dsLanChu, "BuMen");
DropDownList1.DataSource = dsLanChu.Tables["BuMen"];
DropDownList1.DataTextField = "bumenmingcheng";
DropDownList1.DataValueField = "bumenbianma";
DropDownList1.DataBind();
sqlDataAdapter2.Fill(dsLanChu, "ZhiGong");
DropDownList4.DataSource = dsLanChu.Tables["ZhiGong"];
DropDownList4.DataTextField = "zhigongxingming";
DropDownList4.DataValueField = "zhigongbianma";
DropDownList4.DataBind();
sqlDataAdapter3.Fill(dsLanChu, "KeHu");
DropDownList3.DataSource = dsLanChu.Tables["KeHu"];
DropDownList3.DataTextField = "kehuleixing";
DropDownList3.DataValueField = "bianma";
DropDownList3.DataBind();
}
private void Button1_Click(object sender, System.EventArgs e)
{
sqlConnection1.Open();
SqlCommand sqlcmd1 = new SqlCommand("select * from lanchudengji where chuhuzhanghao='"+ TextBox2.Text +"'", sqlConnection1);
SqlDataReader sqlreader1 = sqlcmd1.ExecuteReader();
if(sqlreader1.HasRows == false)
{
sqlreader1.Close();
/**//*sqlreader2.Close();*/
SqlCommand cmd1 = new SqlCommand("insert into lanchudengji (zhigongming,suoshubumen,chuhuzhanghao,lanchujine,lanchuleixing,dakehu,cunruriqi,lururiqi) values ('"+ DropDownList4.SelectedItem.Text +"','"+ DropDownList1.SelectedItem.Value +"','" + TextBox2.Text + "','"+ TextBox3.Text +"','"+ DropDownList2.SelectedItem.Text +"','"+ DropDownList3.SelectedItem.Text +"','"+ TextBox4.Text +"','"+ DateTime.Now.ToString("yyyy-MM-dd") +"')" , sqlConnection1);
cmd1.ExecuteNonQuery();
sqlConnection1.Close();
Response.Write("<script language='javascript'>alert('增加成功');</script>");
}
else
{
//Response.Write("<script language='javascript'>alert('该帐号已经由其他职工揽收');</script>");
//}
//回车键代替TAB键
/**//*<script language="javascript">
function keyDown()
{
var keycode=event.keyCode;
if(keycode==13)
event.keyCode=9;
}
document.οnkeydοwn=keyDown;
</script>*/
sqlreader1.Close();
SqlCommand sqlcmd2 = new SqlCommand("select zhigongming from lanchudengji where chuhuzhanghao='"+ TextBox2.Text +"'", sqlConnection1);
SqlDataReader sqlreader2 = sqlcmd2.ExecuteReader();
sqlreader2.Read();
string strZiGongXingMing = sqlreader2.GetString(0);
sqlreader2.Close();
if(DropDownList4.SelectedItem.Text == strZiGongXingMing)
{
SqlCommand cmd2 = new SqlCommand("insert into lanchudengji (zhigongming,suoshubumen,chuhuzhanghao,lanchujine,lanchuleixing,dakehu,cunruriqi,lururiqi) values ('"+ DropDownList4.SelectedItem.Text +"','"+ DropDownList1.SelectedItem.Value +"','" + TextBox2.Text + "','"+ TextBox3.Text +"','"+ DropDownList2.SelectedItem.Text +"','"+ DropDownList3.SelectedItem.Text +"','"+ TextBox4.Text +"','"+ DateTime.Now.ToString("yyyy-MM-dd") +"')" , sqlConnection1);
cmd2.ExecuteNonQuery();
sqlConnection1.Close();
Response.Write("<script language='javascript'>alert('增加成功');</script>");
}
else
{
Response.Write("<script language='javascript'>alert('该帐号已经由其他职工揽收');</script>");
}
}
TextBox2.Text="";
TextBox3.Text="";
TextBox4.Text="";
}
/**//*private void TextBox5_TextChanged(object sender, System.EventArgs e)
{
for(int i=0,i<=DropDownList4.Items.Count-1,i++)
{
if(DropDownList4.Items[i].Value==TextBox5.Text)
{
DropDownList4.SelectedIndex=i;
}
}
}*/
}
}
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace lanchuxitong
{
/**//// <summary>
/// lanchudengji 的摘要说明。
/// </summary>
public class huoqiluru : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.DropDownList DropDownList2;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.DropDownList DropDownList3;
protected System.Web.UI.WebControls.TextBox TextBox4;
protected System.Web.UI.WebControls.Button Button1;
protected System.Data.SqlClient.SqlConnection sqlConnection1;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Web.UI.WebControls.DropDownList DropDownList4;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter3;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand3;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand3;
protected System.Data.SqlClient.SqlConnection sqlConnection2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator3;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator2;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator4;
protected System.Web.UI.WebControls.TextBox TextBox5;
protected System.Web.UI.WebControls.Label Label8;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand2;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand2;
protected System.Data.SqlClient.SqlConnection sqlConnection3;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label7;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(HttpContext.Current.User.IsInRole("registrar")==false)
{
Response.ClearContent();
Response.ClearHeaders();
Response.Write("您没有权限执行该操作!");
Response.Flush();
Response.Close();
}
/**//*if(!this.IsPostBack)
{
TextBox5.Text=DateTime.Now.ToString("yyyy-MM-dd");
}*/
if(!this.IsPostBack)
{
zjmDataBind();
}
}
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDataAdapter3 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlInsertCommand3 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection2 = new System.Data.SqlClient.SqlConnection();
this.sqlSelectCommand3 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand2 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection3 = new System.Data.SqlClient.SqlConnection();
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
this.sqlConnection1.InfoMessage += new System.Data.SqlClient.SqlInfoMessageEventHandler(this.sqlConnection1_InfoMessage);
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "bumenxinxi", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("bumenbianma", "bumenbianma"),
new System.Data.Common.DataColumnMapping("bumenmingcheng", "bumenmingcheng")})});
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO bumenxinxi(bumenbianma, bumenmingcheng) VALUES (@bumenbianma, @bumenm" +
"ingcheng); SELECT bumenbianma, bumenmingcheng FROM bumenxinxi";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bumenbianma", System.Data.SqlDbType.VarChar, 10, "bumenbianma"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bumenmingcheng", System.Data.SqlDbType.NVarChar, 50, "bumenmingcheng"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT bumenbianma, bumenmingcheng FROM bumenxinxi";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand2;
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "zhigongxinxi", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("zhigongbianma", "zhigongbianma"),
new System.Data.Common.DataColumnMapping("zhigongxingming", "zhigongxingming")})});
//
// sqlDataAdapter3
//
this.sqlDataAdapter3.InsertCommand = this.sqlInsertCommand3;
this.sqlDataAdapter3.SelectCommand = this.sqlSelectCommand3;
this.sqlDataAdapter3.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "kehuleixing", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("bianma", "bianma"),
new System.Data.Common.DataColumnMapping("kehuleixing", "kehuleixing")})});
//
// sqlInsertCommand3
//
this.sqlInsertCommand3.CommandText = "INSERT INTO kehuleixing(bianma, kehuleixing) VALUES (@bianma, @kehuleixing); SELE" +
"CT bianma, kehuleixing FROM kehuleixing";
this.sqlInsertCommand3.Connection = this.sqlConnection2;
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@bianma", System.Data.SqlDbType.VarChar, 10, "bianma"));
this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@kehuleixing", System.Data.SqlDbType.NVarChar, 50, "kehuleixing"));
//
// sqlConnection2
//
this.sqlConnection2.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
//
// sqlSelectCommand3
//
this.sqlSelectCommand3.CommandText = "SELECT bianma, kehuleixing FROM kehuleixing";
this.sqlSelectCommand3.Connection = this.sqlConnection2;
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT zhigongbianma, zhigongxingming FROM zhigongxinxi ORDER BY zhigongxingming";
this.sqlSelectCommand2.Connection = this.sqlConnection3;
//
// sqlInsertCommand2
//
this.sqlInsertCommand2.CommandText = "INSERT INTO zhigongxinxi(zhigongxingming) VALUES (@zhigongxingming); SELECT zhigo" +
"ngbianma, zhigongxingming FROM zhigongxinxi ORDER BY zhigongxingming";
this.sqlInsertCommand2.Connection = this.sqlConnection3;
this.sqlInsertCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@zhigongxingming", System.Data.SqlDbType.NVarChar, 20, "zhigongxingming"));
//
// sqlConnection3
//
this.sqlConnection3.ConnectionString = "user id=" + System.Configuration.ConfigurationSettings.AppSettings["UserID"] + ";data source=" + System.Configuration.ConfigurationSettings.AppSettings["DbServerName"]
+ ";persist security info=True;initial catalog=" + System.Configuration.ConfigurationSettings.AppSettings["DbName"] + ";password=" + System.Configuration.ConfigurationSettings.AppSettings["Password"];
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void sqlConnection1_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e)
{
}
private void zjmDataBind()
{
DataSet dsLanChu = new DataSet();
sqlDataAdapter1.Fill(dsLanChu, "BuMen");
DropDownList1.DataSource = dsLanChu.Tables["BuMen"];
DropDownList1.DataTextField = "bumenmingcheng";
DropDownList1.DataValueField = "bumenbianma";
DropDownList1.DataBind();
sqlDataAdapter2.Fill(dsLanChu, "ZhiGong");
DropDownList4.DataSource = dsLanChu.Tables["ZhiGong"];
DropDownList4.DataTextField = "zhigongxingming";
DropDownList4.DataValueField = "zhigongbianma";
DropDownList4.DataBind();
sqlDataAdapter3.Fill(dsLanChu, "KeHu");
DropDownList3.DataSource = dsLanChu.Tables["KeHu"];
DropDownList3.DataTextField = "kehuleixing";
DropDownList3.DataValueField = "bianma";
DropDownList3.DataBind();
}
private void Button1_Click(object sender, System.EventArgs e)
{
sqlConnection1.Open();
SqlCommand sqlcmd1 = new SqlCommand("select * from lanchudengji where chuhuzhanghao='"+ TextBox2.Text +"'", sqlConnection1);
SqlDataReader sqlreader1 = sqlcmd1.ExecuteReader();
if(sqlreader1.HasRows == false)
{
sqlreader1.Close();
/**//*sqlreader2.Close();*/
SqlCommand cmd1 = new SqlCommand("insert into lanchudengji (zhigongming,suoshubumen,chuhuzhanghao,lanchujine,lanchuleixing,dakehu,cunruriqi,lururiqi) values ('"+ DropDownList4.SelectedItem.Text +"','"+ DropDownList1.SelectedItem.Value +"','" + TextBox2.Text + "','"+ TextBox3.Text +"','"+ DropDownList2.SelectedItem.Text +"','"+ DropDownList3.SelectedItem.Text +"','"+ TextBox4.Text +"','"+ DateTime.Now.ToString("yyyy-MM-dd") +"')" , sqlConnection1);
cmd1.ExecuteNonQuery();
sqlConnection1.Close();
Response.Write("<script language='javascript'>alert('增加成功');</script>");
}
else
{
//Response.Write("<script language='javascript'>alert('该帐号已经由其他职工揽收');</script>");
//}
//回车键代替TAB键
/**//*<script language="javascript">
function keyDown()
{
var keycode=event.keyCode;
if(keycode==13)
event.keyCode=9;
}
document.οnkeydοwn=keyDown;
</script>*/
sqlreader1.Close();
SqlCommand sqlcmd2 = new SqlCommand("select zhigongming from lanchudengji where chuhuzhanghao='"+ TextBox2.Text +"'", sqlConnection1);
SqlDataReader sqlreader2 = sqlcmd2.ExecuteReader();
sqlreader2.Read();
string strZiGongXingMing = sqlreader2.GetString(0);
sqlreader2.Close();
if(DropDownList4.SelectedItem.Text == strZiGongXingMing)
{
SqlCommand cmd2 = new SqlCommand("insert into lanchudengji (zhigongming,suoshubumen,chuhuzhanghao,lanchujine,lanchuleixing,dakehu,cunruriqi,lururiqi) values ('"+ DropDownList4.SelectedItem.Text +"','"+ DropDownList1.SelectedItem.Value +"','" + TextBox2.Text + "','"+ TextBox3.Text +"','"+ DropDownList2.SelectedItem.Text +"','"+ DropDownList3.SelectedItem.Text +"','"+ TextBox4.Text +"','"+ DateTime.Now.ToString("yyyy-MM-dd") +"')" , sqlConnection1);
cmd2.ExecuteNonQuery();
sqlConnection1.Close();
Response.Write("<script language='javascript'>alert('增加成功');</script>");
}
else
{
Response.Write("<script language='javascript'>alert('该帐号已经由其他职工揽收');</script>");
}
}
TextBox2.Text="";
TextBox3.Text="";
TextBox4.Text="";
}
/**//*private void TextBox5_TextChanged(object sender, System.EventArgs e)
{
for(int i=0,i<=DropDownList4.Items.Count-1,i++)
{
if(DropDownList4.Items[i].Value==TextBox5.Text)
{
DropDownList4.SelectedIndex=i;
}
}
}*/
}
}