?? form1.cs
字號:
this.toolBarButton4,
this.toolBarButton5});
this.toolBar1.DropDownArrows = true;
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(626, 38);
this.toolBar1.TabIndex = 3;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton1
//
this.toolBarButton1.Text = "新建";
//
// toolBarButton2
//
this.toolBarButton2.Text = "瀏覽";
//
// toolBarButton3
//
this.toolBarButton3.Text = "查詢";
//
// toolBarButton4
//
this.toolBarButton4.Text = "退出";
//
// toolBarButton5
//
this.toolBarButton5.Text = "幫助";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem5,
this.menuItem6});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItem4});
this.menuItem1.Text = "操作";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "新建";
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "瀏覽";
//
// menuItem4
//
this.menuItem4.Index = 2;
this.menuItem4.Text = "查詢";
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "退出";
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "幫助";
//
// groupBox3
//
this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.comboBox6,
this.comboBox5,
this.comboBox4,
this.label5,
this.label4,
this.label6});
this.groupBox3.ForeColor = System.Drawing.SystemColors.Desktop;
this.groupBox3.Location = new System.Drawing.Point(224, 64);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(192, 184);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "查詢條件";
//
// comboBox6
//
this.comboBox6.Items.AddRange(new object[] {
">",
">=",
"=",
"<=",
"<",
"<>"});
this.comboBox6.Location = new System.Drawing.Point(88, 136);
this.comboBox6.Name = "comboBox6";
this.comboBox6.Size = new System.Drawing.Size(88, 20);
this.comboBox6.TabIndex = 6;
//
// comboBox5
//
this.comboBox5.Items.AddRange(new object[] {
">",
">=",
"=",
"<=",
"<",
"<>"});
this.comboBox5.Location = new System.Drawing.Point(88, 88);
this.comboBox5.Name = "comboBox5";
this.comboBox5.Size = new System.Drawing.Size(88, 20);
this.comboBox5.TabIndex = 5;
//
// comboBox4
//
this.comboBox4.Items.AddRange(new object[] {
">",
">=",
"=",
"<=",
"<",
"<>"});
this.comboBox4.Location = new System.Drawing.Point(88, 40);
this.comboBox4.Name = "comboBox4";
this.comboBox4.Size = new System.Drawing.Size(88, 20);
this.comboBox4.TabIndex = 4;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(626, 267);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.groupBox3,
this.toolBar1,
this.groupBox2,
this.groupBox1});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "人員基本信息管理";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 應用程序的主入口點。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
if ( e.Button == toolBarButton1 )
{
string selectString = "SELECT * FROM 人員基本信息管理";
Form2 frm2 = new Form2();
frm2.receive = selectString;
frm2.remark = 1;
frm2.ShowDialog();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///*瀏覽按鈕*////////////////////////////////////////////////////////////////////////////////////////////////
else if(e.Button == toolBarButton2)
{
string selectString = "SELECT * FROM 人員基本信息管理";
string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
SqlConnection mySqlConnection = new SqlConnection(connectionString);
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = selectString;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataSet myDataSet = new DataSet();
mySqlConnection.Open();
mySqlDataAdapter.Fill(myDataSet,"人員基本信息管理");
mySqlConnection.Close();
DataTable myDataTable = myDataSet.Tables["人員基本信息管理"];
Form3 frm3 = new Form3();
frm3.test = selectString;
frm3.ShowDialog();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
///*查詢按鈕*////////////////////////////////////////////////////////////////////////////////////////////////
else if(e.Button == toolBarButton3)
{
string con1;
string con2;
string con3;
string conf;
string coe1 = comboBox1.Text;
string coe2 = comboBox2.Text;
string coe3 = comboBox3.Text;
string ope1 = comboBox4.Text;
string ope2 = comboBox5.Text;
string ope3 = comboBox6.Text;
string val1 = textBox1.Text;
string val2 = textBox2.Text;
string val3 = textBox3.Text;
if ( comboBox3.Text.Length == 0 )
{
if ( comboBox2.Text.Length == 0 )
{
if ( coe1 == "崗薪工資" || coe1 == "檔案工資" || coe1 == "參保額")
{
con1 = coe1+" " +ope1+" " +val1;
}
else
{
con1 = coe1+" " +ope1+" " +"'"+val1+"'";
}
conf = con1;
}
else
{
if ( coe1 == "崗薪工資" || coe1 == "檔案工資" || coe1 == "參保額")
{
con1 = coe1+" " +ope1+" " +val1;
}
else
{
con1 = coe1+" " +ope1+" " +"'"+val1+"'";
}
if ( coe2 == "崗薪工資" || coe2 == "檔案工資" || coe2 == "參保額")
{
con2 = coe2+" " +ope2+" " +val2;
}
else
{
con2 = coe2+" " +ope2+" " +"'"+val2+"'";
}
conf = con1+" AND "+con2;
}
}
else
{
if ( coe1 == "崗薪工資" || coe1 == "檔案工資" || coe1 == "參保額")
{
con1 = coe1+" " +ope1+" " +val1;
}
else
{
con1 = coe1+" " +ope1+" " +"'"+val1+"'";
}
if ( coe2 == "崗薪工資" || coe2 == "檔案工資" || coe2 == "參保額")
{
con2 = coe2+" " +ope2+" " +val2;
}
else
{
con2 = coe2+" " +ope2+" " +"'"+val2+"'";
}
if ( coe3 == "崗薪工資" || coe3 == "檔案工資" || coe3 == "參保額")
{
con3 = coe3+" " +ope3+" " +val3;
}
else
{
con3 = coe3+" " +ope3+" " +"'"+val3+"'";
}
conf = con1+" AND "+con2+" AND "+con3;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////檢查條件是否為空
if (textBox1.Text.Length==0)
{
MessageBox.Show("請輸入值");
if ( comboBox4.Text.Length == 0)
{
MessageBox.Show("請輸入關系運算符");
if (comboBox1.Text.Length == 0 )
{
MessageBox.Show("請輸入查詢項");
}
}
}
else if(comboBox1.Text.Length == 0)
{
MessageBox.Show("請輸入查詢項");
if ( comboBox4.Text.Length == 0)
{
MessageBox.Show("請輸入關系運算符");
if(textBox1.Text.Length == 0)
{
MessageBox.Show("請輸入值");
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////實現查詢功能
else
{
string selectString = "SELECT * FROM 人員基本信息管理 WHERE "+conf;
string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
SqlConnection mySqlConnection = new SqlConnection(connectionString);
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = selectString;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataSet myDataSet = new DataSet();
mySqlConnection.Open();
mySqlDataAdapter.Fill(myDataSet,"人員基本信息管理");
mySqlConnection.Close();
DataTable myDataTable = myDataSet.Tables["人員基本信息管理"];
Form3 frm3 = new Form3();
//frm3.dataset1 = myDataSet;
frm3.test = selectString;
frm3.ShowDialog();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////退出/////////////////////////////////////////////////////////////////////////////////////////////////
else if ( e.Button == toolBarButton4 )
{
Application.Exit();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////幫助/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
else if(e.Button == toolBarButton5)
{
}
}
private void menuItem3_Click(object sender, System.EventArgs e)//瀏覽
{
string selectString = "SELECT * FROM 人員基本信息管理";
string connectionString = "server=server;database=sgerp;uid=sa;pwd=sa";
SqlConnection mySqlConnection = new SqlConnection(connectionString);
SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
mySqlCommand.CommandText = selectString;
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataSet myDataSet = new DataSet();
mySqlConnection.Open();
mySqlDataAdapter.Fill(myDataSet,"人員基本信息管理");
mySqlConnection.Close();
DataTable myDataTable = myDataSet.Tables["人員基本信息管理"];
Form3 frm3 = new Form3();
//frm3.dataset1 = myDataSet;
frm3.test = selectString;
frm3.ShowDialog();
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -