?? fmlou.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 招聘考試成績管理系統
{
/// <summary>
/// FMlou 的摘要說明。
/// </summary>
public class FMlou : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button btok;
private System.Windows.Forms.TextBox txtcheck;
private System.Windows.Forms.GroupBox groupBox1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private 招聘考試成績管理系統.DataSet1 dataSet11;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public FMlou()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設計器生成的代碼
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.btok = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.txtcheck = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.dataSet11 = new 招聘考試成績管理系統.DataSet1();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.SuspendLayout();
//
// btok
//
this.btok.Location = new System.Drawing.Point(24, 136);
this.btok.Name = "btok";
this.btok.TabIndex = 1;
this.btok.Text = "確定";
this.btok.Click += new System.EventHandler(this.btok_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.dataGrid1);
this.groupBox2.Location = new System.Drawing.Point(144, 24);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(400, 312);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "已錄用考生";
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.DataSource = this.dataSet11.employ_student;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(8, 24);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.RowHeadersVisible = false;
this.dataGrid1.Size = new System.Drawing.Size(380, 256);
this.dataGrid1.TabIndex = 0;
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Items.AddRange(new object[] {
"考生姓名",
"準考證號",
"錄用單位"});
this.comboBox1.Location = new System.Drawing.Point(8, 40);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(112, 20);
this.comboBox1.TabIndex = 1;
//
// txtcheck
//
this.txtcheck.Location = new System.Drawing.Point(8, 88);
this.txtcheck.Name = "txtcheck";
this.txtcheck.Size = new System.Drawing.Size(112, 21);
this.txtcheck.TabIndex = 1;
this.txtcheck.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btok);
this.groupBox1.Controls.Add(this.txtcheck);
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Location = new System.Drawing.Point(8, 72);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(128, 184);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查詢錄用情況";
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=\"GHX-82E19EF0633\";packet size=4096;integrated security=SSPI;data s" +
"ource=\".\";persist security info=False;initial catalog=zhaopin";
//
// 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", "employ_student", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("準考證號", "準考證號"),
new System.Data.Common.DataColumnMapping("姓名", "姓名"),
new System.Data.Common.DataColumnMapping("錄用單位", "錄用單位"),
new System.Data.Common.DataColumnMapping("聯系人", "聯系人"),
new System.Data.Common.DataColumnMapping("聯系電話", "聯系電話")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT Zno AS 準考證號, Name AS 姓名, Dname AS 錄用單位, Dlixiren AS 聯系人, Dtel AS 聯系電話 FROM" +
" employ_student";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO employ_student(Zno, Name, Dname, Dlixiren, Dtel) VALUES (@Zno, @Name," +
" @Dname, @Dlixiren, @Dtel); SELECT Zno AS 準考證號, Name AS 姓名, Dname AS 錄用單位, Dlixi" +
"ren AS 聯系人, Dtel AS 聯系電話 FROM employ_student";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Zno", System.Data.SqlDbType.Int, 4, "準考證號"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Name", System.Data.SqlDbType.VarChar, 10, "姓名"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Dname", System.Data.SqlDbType.VarChar, 50, "錄用單位"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Dlixiren", System.Data.SqlDbType.VarChar, 50, "聯系人"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Dtel", System.Data.SqlDbType.VarChar, 50, "聯系電話"));
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// FMlou
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(556, 354);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FMlou";
this.Text = "錄用信息";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FMlou_Load);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void FMlou_Load(object sender, System.EventArgs e)
{
this.comboBox1.SelectedIndex=0;
sqlDataAdapter1.Fill(dataSet11,"employ_student");
}
private void btok_Click(object sender, System.EventArgs e)
{
try
{
if(this.txtcheck.Text.Trim()=="")
return;
string str ="SELECT Zno AS 準考證號, Name AS 姓名, Dname AS 錄用單位, Dlixiren AS 聯系人, Dtel AS 聯系電話 FROM employ_student ";
if(this.comboBox1.SelectedIndex==0)
str +="where Name='"+this.txtcheck.Text.Trim()+"'";
else if(this.comboBox1.SelectedIndex==1)
str +="where Zno='"+this.txtcheck.Text.Trim()+"'";
else
str +="where Dname='"+this.txtcheck.Text.Trim()+"'";
this.sqlDataAdapter1.SelectCommand.CommandText =str;
dataSet11.Clear();
sqlDataAdapter1.Fill(dataSet11,"employ_student");
}
catch(Exception oe)
{
MessageBox.Show(oe.Message,"Error");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -