⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fmlou.cs

📁 招聘考试成绩管理系统,自己做的,C#的,我的软件工程作业
💻 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 + -