frmload.cs

来自「关于医院进销存的系统」· CS 代码 · 共 48 行

CS
48
字号
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 YYJXC
{
    public partial class frmLoad : Form
    {
        public frmLoad()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() != "" && textBox2.Text != "")
            {
                SqlConnection Conn = new SqlConnection("server=" + CLoad.ReadServer() + ";pwd=" + CLoad.ReadPwd() + ";uid=sa;database=YYJXC");
                SqlCommand Comm = new SqlCommand("select * from tb_Admini where id='" + textBox1.Text.Trim() + "' and pwd='" + CStrLock.CJiaMi.Lock(textBox2.Text) + "'", Conn);
                Conn.Open();
                SqlDataReader dr = Comm.ExecuteReader();
                if (dr.Read())
                {
                    CLoad.UserId = dr.GetString(0);
                    CLoad.UserPwd = CStrLock.CJiaMi.UnLock(dr.GetString(1));
                    Conn.Close();
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    Conn.Close();
                    MessageBox.Show("用户名或密码不正确!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    textBox1.Focus();
                    textBox1.SelectAll();
                }
            }
            else
            {
                MessageBox.Show("请输入完整!","信息提示");
            }
        }
    }
}

⌨️ 快捷键说明

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