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

📄 form1.cs

📁 这是一个银行储蓄系统的源代码及数据库文件
💻 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 Store
{
    public partial class form1 : Form
    {
        public form1()
        {
            InitializeComponent();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=银行储蓄系统;Integrated Security=SSPI");
            if ((textBox1.Text != "") && (textBox2.Text != ""))
            {
                try
                {
                    connection.Open();
                    string strSQL = "select * from 业务员信息 where 业务员编号='" + textBox1.Text.ToString() + "'and 密码='" + textBox2.Text.ToString() + "'";
                    SqlCommand cmd = new SqlCommand(strSQL, connection);
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        //this.Close();
                        Form3 form = new Form3();
                        form.Show();
                    }
                    else
                    {
                        MessageBox.Show("用户名或口令有错,请重新输入!");
                    }
                }
                catch (SqlException b)
                {
                    Console.WriteLine(b.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
            else
            {
                MessageBox.Show("请输入完整的正确信息!");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode==Keys.Enter)
            {
                this.button3_Click(button3, new EventArgs());
            }
        }
       
    }
}

⌨️ 快捷键说明

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