示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt;
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";

            sql = "SELECT * FROM user_info WHERE user_code = '" + tb_userName.Text + "' AND pass_word = '" + tb_userPassword.Text + "'";
            var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            if (dt.Rows.Count == 1)
            {
                int    i  = dt.Rows.Count;
                FRM_CC fc = new FRM_CC();
                this.Visible = false;
                fc.Show();
            }
            else
            {
                int i = dt.Rows.Count;
                MessageBox.Show("请检查用户名和密码是否正确!");
            }
        }
示例#2
0
文件: frmLogin.cs 项目: 13TT/TEST2
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt;
            var       db        = new DBAccess_MySql("MySql");
            string    outString = "";

            sql = "SELECT * FROM user_info WHERE user_code = '" + tb_userName.Text + "' AND pass_word = '" + tb_userPassword.Text + "'";
            var rlt = db.QuerySQL_ToTable(sql, out dt, out outString);

            if (dt.Rows.Count == 1)
            {
                int    i  = dt.Rows.Count;
                FRM_CC fc = new FRM_CC();
                this.Visible = false;
                fc.Show();
            }
            else
            {
                int i = dt.Rows.Count;
                MessageBox.Show("请检查用户名和密码是否正确!");
            }

            sql = "SELECT use_pl_new_pallet FROM user_info WHERE user_code = '" + tb_userName.Text + "'";
            var rlt1 = db.QuerySQL_ToTable(sql, out dt, out outString);

            try
            {
                DataRow dr = dt.Rows[0];
                string  s  = dr[0].ToString();

                sql = "UPDATE config_unit SET table_name = '" + tb_userName.Text + "',unit_name = '" + s + "'";
                db.ExecSql(sql, out outString);
            }
            catch
            {
            }
        }