基本信息
源码名称:C#超市管理系统源码(含数据库以及设计报告)
源码大小:2.95M
文件格式:.rar
开发语言:C#
更新时间:2017-06-13
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

namespace supmarket_system

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            string SQL = "Data Source=(local);Initial Catalog=supermar_data;Integrated Security=True";

            SqlConnection conn = new SqlConnection(SQL);

            SqlCommand mycomm = new SqlCommand(SQL,conn);

            SqlDataAdapter myDA = new SqlDataAdapter(mycomm);

            string mySQL = "select Name,Pass from Employee where Name ='";

            mySQL =textBox1.Text "' and Pass ='" textBox2.Text "'";

            conn.Open();

            mycomm.CommandText = mySQL;

            mycomm.Connection = conn;

            myDA.SelectCommand = mycomm;

            DataSet DSetEmp = new DataSet();

            myDA.Fill(DSetEmp,"Employee");

            if (textBox1.Text == "" || textBox2.Text == "")

            {

                MessageBox.Show("请输入用户名和密码!");

            }

            try

            {

                if (DSetEmp.Tables["Employee"].Rows.Count == 0)

                {

                 MessageBox.Show("用户名或者密码不正确,请重新输入!");

                    return;

                }

                else

                {

                    Form2.isLogin = true;

                    Form2.Username = this.textBox1.Text;

                    Form2 form2 = new Form2();

                    form2.ShowDialog();

                }

            }

            catch (Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

            finally

            {

                conn.Close();

            }

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

 

        }

 

        private void button2_Click(object sender, EventArgs e)

        {

            this.Close();

        }

    }

}