📄 target.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace BlueHill_Win_
{
public partial class Target : Form
{
public Target()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("你的工作是否已经及时保存?\r\n你确定要退出系统?\r\n点击[确定]退出", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
Application.ExitThread();
}
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox2.Text.ToString().Trim() == "")
{
DialogResult = MessageBox.Show("请输入你的密码!", "提示");
textBox2.Focus();
}
else
{
SqlConnection con = DB.connection();
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from 员工表 where 员工登录名='" + textBox1.Text.ToString().Trim() + "'and 员工密码='" + textBox2.Text.ToString().Trim() + "' ", con);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count > 0)
{
DialogResult = MessageBox.Show("成功解锁!", "提示");
this.Dispose();
}
else
DialogResult = MessageBox.Show("密码错误!", "提示");
textBox2.Text = "";
textBox2.Focus();
}
}
private void Target_Load(object sender, EventArgs e)
{
textBox1.Text = DB.getA;
//SqlConnection con = DB.connection();
//con.Open();
}
private void Target_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -