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

📄 searchnameframe.cs

📁 独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 
💻 CS
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data;using System.Data.SqlClient;namespace WindowsApplication.searchBrushFrameHistory{	public class searchNameFrame : WindowsApplication.ParentFrame	{
		#region 变量定义...
		private string searchEmpName="select distinct 职工名称 from Emp_Time";
		#endregion
		#region 数据库变量...
		private ConnectionData conn=new ConnectionData();
		private DataTable tempTable=new DataTable();
		#endregion
		#region 控件声明...
		private System.Windows.Forms.ComboBox textName;		private System.ComponentModel.IContainer components = null;		#endregion		#region 构造函数		public searchNameFrame()		{			// 该调用是 Windows 窗体设计器所必需的。			InitializeComponent();			// TODO: 在 InitializeComponent 调用后添加任何初始化		}		/// <summary>		/// 清理所有正在使用的资源。		/// </summary>		protected override void Dispose( bool disposing )		{			if( disposing )			{				if (components != null) 				{					components.Dispose();				}			}			base.Dispose( disposing );		}		#endregion		#region 设计器生成的代码		/// <summary>		/// 设计器支持所需的方法 - 不要使用代码编辑器修改		/// 此方法的内容。		/// </summary>		private void InitializeComponent()		{			this.textName = new System.Windows.Forms.ComboBox();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(264, 32);
			this.label1.Text = "姓名查询";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(40, 88);
			this.button1.Name = "button1";
			this.button1.Text = "查询(&S)";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(152, 88);
			this.button2.Name = "button2";
			// 
			// label2
			// 
			this.label2.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
			this.label2.Location = new System.Drawing.Point(40, 48);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(40, 24);
			this.label2.Tag = "姓名:";
			this.label2.Text = "姓名:";
			// 
			// textName
			// 
			this.textName.Location = new System.Drawing.Point(88, 48);
			this.textName.Name = "textName";
			this.textName.Size = new System.Drawing.Size(120, 20);
			this.textName.TabIndex = 4;
			// 
			// searchNameFrame
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(258, 127);
			this.Controls.Add(this.textName);
			this.Name = "searchNameFrame";
			this.Load += new System.EventHandler(this.searchNameFrame_Load);
			this.Controls.SetChildIndex(this.textName, 0);
			this.Controls.SetChildIndex(this.label1, 0);
			this.Controls.SetChildIndex(this.button1, 0);
			this.Controls.SetChildIndex(this.button2, 0);
			this.Controls.SetChildIndex(this.label2, 0);
			this.ResumeLayout(false);

		}		#endregion		#region DataFunction
		private DataTable ExcuteSql(string strSql,string tableName)
		{
			DataSet dsSet=new DataSet();
			DataTable dsTable=new DataTable();
			try
			{
				dsSet=conn.ExcuteDataSetResult(strSql,tableName);
				dsTable=dsSet.Tables[0];
			}
			catch(Exception eles)
			{
				MessageBox.Show(this,eles.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
			return dsTable;
		}
		#endregion
		#region 初始化事件...
		private void searchNameFrame_Load(object sender, System.EventArgs e)
		{
			try
			{
                tempTable=ExcuteSql(searchEmpName,"Emp_Time");
				FillEmpName(tempTable);
			}
			catch(Exception ele)
			{
				MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
		}		#endregion		#region 填充职工名称下拉列表框...		private void FillEmpName(DataTable tempdata)		{			for(int i=0;i<tempdata.Rows.Count;i++)			{				this.textName.Items.Add(tempdata.Rows[i][0].ToString().Trim());			}		}		#endregion
		#region 查询按钮事件...
		private void button1_Click(object sender, System.EventArgs e)
		{
		
		}		#endregion	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -