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

📄 dlwin.cs

📁 这是本人学习语言来第一次写的程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("用户名", System.Data.OleDb.OleDbType.VarWChar, 20, "用户名"));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_用户名", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户名", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_姓名", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "姓名", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_姓名1", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "姓名", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_密码", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_性别", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "性别", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
			this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员1", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
			// 
			// dataSet21
			// 
			this.dataSet21.DataSetName = "DataSet2";
			this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// button2
			// 
			this.button2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.button2.Location = new System.Drawing.Point(145, 88);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(56, 23);
			this.button2.TabIndex = 3;
			this.button2.Text = "退出";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// dlWin
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(274, 120);
			this.ControlBox = false;
			this.Controls.Add(this.button1);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.button2);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "dlWin";
			this.Opacity = 0.85;
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "图书馆信息管理系统登录";
			this.TopMost = true;
			this.Load += new System.EventHandler(this.dlWin_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			try
			{
				System.Data.OleDb.OleDbCommand MySelectYh = this.oleDbConnection1.CreateCommand();
				System.Data.OleDb.OleDbCommand MySelectXt = this.oleDbConnection1.CreateCommand();
				MySelectYh.CommandText = "SELECT * FROM ygxxb WHERE 用户名='"+this.textBox1.Text+"' AND 密码='"+this.textBox2.Text+"'";
				MySelectXt.CommandText = "SELECT * FROM ygxxb WHERE 系统管理员='是'and 用户名='"+this.textBox1.Text+"'";
				this.oleDbDataAdapter1.SelectCommand = MySelectYh;
				this.oleDbConnection1.Open();
				if( oleDbDataAdapter1.Fill(this.dataSet21,"ygxxb") == 0)
				{
					Dlcs++;
					if( Dlcs>=3)
					{
						this.DialogResult = DialogResult.No;
					}
					else
					{
						MessageBox.Show("用户名或密码错误!你已经登录"+Dlcs.ToString()+"次.","登录提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
					}
				}
				else
				{
					this.oleDbDataAdapter1.SelectCommand = MySelectXt;
					if( oleDbDataAdapter1.Fill(this.dataSet21,"ygxxb")==0 )
						this.ifSyAd=false;
					else
						this.ifSyAd=true;
					this.DialogResult = DialogResult.Yes;
					this.Close();
				}
				this.oleDbConnection1.Close();
			}
			catch(Exception Exc)
			{
				MessageBox.Show(Exc.Message);
				this.Close();
			}
		}

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{
			if(this.textBox1.Text != "" || this.textBox2.Text != "")
			{
				this.button2.Text="重填";
			}
			else
			{
				this.button2.Text="退出";
			}
		}

		private void textBox2_TextChanged(object sender, System.EventArgs e)
		{
			this.textBox1_TextChanged(null,null);
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			if(this.button2.Text=="重填")
			{
				this.textBox1.Text="";
				this.textBox2.Text="";
				this.textBox1.Focus();
			}
			else
			{
				if( MessageBox.Show("你还没登录就要退出吗?","登录提示:",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK)
				{
					this.DialogResult=DialogResult.No;
					this.Close();					
				}
			}
		}

		private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			int Key=(int)e.KeyCode;
			switch(Key)
			{
				case 27:
					if( MessageBox.Show("你还没登录就要退出吗?","登录提示:",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) == DialogResult.OK)
					{
						this.DialogResult=DialogResult.No;
						this.Close();					
					}
					break;
				case 13:
					this.button1_Click(null,null);
					break;
				case 38:
				case 37:
					if( this.textBox1.Focused)
					{
						this.button2.Focus();
					}
					else
					{
						if( this.button2.Focused)
						{
							this.button1.Focus();
						}
						else
						{
							if( this.button1.Focused)
							{
								this.textBox2.Focus();
							}
							else
							{
								if( this.textBox2.Focused)
								{
									this.textBox1.Focus();
								}
							}
						}
					}
					break;
				case 40:
				case 39:
					if( this.textBox1.Focused)
					{
						this.textBox2.Focus();
					}
					else
					{
						if( this.textBox2.Focused)
						{
							this.button1.Focus();
						}

					}
					break;
			}
		}

		private void textBox2_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			this.textBox1_KeyDown(null,e);
		}

		private void dlWin_Load(object sender, System.EventArgs e)
		{
			this.textBox1.Focus();
		}
	}
}

⌨️ 快捷键说明

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