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

📄 denglujiemian.cs

📁 Vs2005C#图书管理系统初学的看看有好处的
💻 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 tsh
{
    public partial class F1 : Form
    {

        public F1()
        {
            InitializeComponent();
        }
        DB.ClsSQL sql = new DB.ClsSQL(".", "mylw", "sa", "", 3);
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {

           DataSet ds;
           string s1="select * from employee where yuangongbianhao='" + textBox1.Text.Trim() + "' and mima='" + textBox2.Text.Trim() + "'";
            ds = sql.DBToDS(s1, "employee");
           if (ds.Tables["employee"].Rows.Count > 0)
           {   
               this.Hide();
               
               F2 f2 = new F2();
               f2.Show();
               
           }
           else
           {
               MessageBox.Show("用户名或密码错误!!!", "登录提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
               
               textBox1.Text = "";
               textBox2.Text = "";
               textBox1.Focus();
           }

        }

        private void F1_Load(object sender, EventArgs e)
        {
            textBox1.Focus();
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {


            if (!(((e.KeyChar >= '0') && (e.KeyChar <= '9')) || e.KeyChar <= 31) || e.KeyChar == '.')
            {
                e.Handled = true;
            }
            if (e.KeyChar==13)
            {
                textBox2.Focus();
            }
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {

            if (e.KeyChar == 13)
                button1_Click(null, null);
        }

        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode.ToString() == "Up")
                textBox1.Focus();
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode.ToString() == "Down")
                textBox2.Focus();
        }
               
               
                    
               
                    
           
        
    }
}

⌨️ 快捷键说明

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