flogin2.cs

来自「  一个用C#编写的图书管系统」· CS 代码 · 共 69 行

CS
69
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


namespace Library
{
    public partial class fLogin2 : Form
    {
        public fLogin2()
        {
            InitializeComponent();
        }
        private int Count;
        private void fLogin_Load(object sender, EventArgs e)
        {
           
            Count = 0;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select ReaderPassword from Reader where ReaderXueHao= '" + textBox1.Text + "'";
            DataSet ds = Library.ExecuteDataSet(sql);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ReaderPassword"].ToString() == textBox2.Text)
                {
                    this.DialogResult = DialogResult.OK;
                }
               else
                {
                    MessageBox.Show("输入的密码不正确!", "系统提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    textBox2.Focus();
                    textBox2.SelectAll();
                    Count++;
                }

            }
                else
                {
                    MessageBox.Show("输入的用户名不存在!", "友好提示:");
                    textBox1.Focus();
                    textBox1.SelectAll();
                    Count++;

                }
                if (Count > 3)
                {
                    MessageBox.Show("输入错误次数大于3次,系统将自动退出!", "系统提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Close();
                }
           
            }

        private void button2_Click(object sender, EventArgs e)
        {
        Application.Exit();
        }

        }

        
    }

⌨️ 快捷键说明

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