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

📄 dl.cs

📁 实习时候做的一个c#的财务管理系统
💻 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 cwgl
{
    public partial class dl : Form
    {
        public dl()
        {
            InitializeComponent();
        }

        SqlConnection con = new SqlConnection(global::cwgl.Properties.Settings.Default.cwglCon);

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

        private void button1_Click(object sender, EventArgs e)
        {
            string t1 = textBox1.Text.ToString().Trim();
            string t2 = textBox2.Text.ToString().Trim();
            
            try
            {
                con.Open();
                string sql = "SELECT  * FROM admin";
                SqlCommand com = new SqlCommand(sql, con);
                SqlDataReader sdr = com.ExecuteReader();
                sdr.Read();
                    if (Convert.ToString(sdr["users"]) == t1 && Convert.ToString(sdr["password"]) == t2)
                    {
                        main m = new main();
                        m.Show();
                       
                        sdr.Close();
                        con.Close();
                        this.Close();
                    }
                    else if (Convert.ToString(sdr["users"]) != t1)
                    {
                        MessageBox.Show("用户名错误,请重新输入!", "系统提示");
                        this.textBox1.Text = "";
                        this.textBox2.Text = "";
                        return;
                    }
                    else
                    {
                        MessageBox.Show("密码错误,请重新输入!","系统提示");
                        this.textBox2.Text = "";
                        return;

                    }
                }

            
            catch (SqlException e1)
            {
            }
            finally
            {
                con.Close();
            }



        }
    }
}

⌨️ 快捷键说明

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