Esempio n. 1
0
        private void xxgl_FormClosing(object sender, FormClosingEventArgs e)
        {
            string s      = textBox1.Text;
            用户     yonghu = new 用户(s);

            yonghu.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("用户名不能为空!");
                textBox1.Focus();
            }
            else if (textBox2.Text == "")
            {
                MessageBox.Show("密码不能为空!");
                textBox2.Focus();
            }
            else
            {
                DBS.sql.Open();
                string sex;
                if (radioButton1.Checked)
                {
                    sex = radioButton1.Text;
                }
                else
                {
                    sex = radioButton2.Text;
                }

                string     com     = "update 用户表 set 用户密码='" + this.textBox2.Text + "',用户地址='" + this.textBox3.Text + "',用户手机号='" + this.textBox4.Text + "',用户性别= '" + sex + "' where 用户名='" + this.textBox1.Text + "' ";
                SqlCommand command = new SqlCommand(com, DBS.sql);
                command.ExecuteNonQuery();
                DBS.sql.Close();
                MessageBox.Show("修改成功!");
                string s      = textBox1.Text;
                用户     yonghu = new 用户(s);
                yonghu.Show();
                this.Hide();
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                string        constr        = "server=(local); database='手机销售系统'; uid='sjxs';pwd='123456'";
                SqlConnection sqlConnection = new SqlConnection(constr);
                sqlConnection.Open();
                string        comm          = "select 管理员工号,管理员密码 from 管理员表 where 管理员工号='" + textBox1.Text + "' and 管理员密码='" + textBox2.Text + "' ";
                SqlCommand    sqlCommand    = new SqlCommand(comm, sqlConnection);
                SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
                if (!sqlDataReader.Read())
                {
                    if (this.textBox1.Text == "" || this.textBox2.Text == "")
                    {
                        MessageBox.Show("用户名或密码不能为空!");
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误!");
                        this.textBox1.Clear();
                        this.textBox1.Clear();
                        textBox1.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("登录成功!");
                    管理员 guanliyuan = new 管理员();
                    guanliyuan.Show();
                    this.Hide();
                }
                sqlConnection.Close();
                //if (this.textBox1.Text == "" || this.textBox2.Text == "")
                //{
                //    MessageBox.Show("账户或密码不为空");
                //}
                //if (this.textBox1.Text == "admin" && this.textBox2.Text == "admin")
                //{
                //    MessageBox.Show("管理员登录成功");
                //    管理员 guanliyuan = new 管理员();
                //    guanliyuan.Show();
                //    this.Hide();

                //}
            }
            else
            {
                string        con     = "server=(local);database='手机销售系统';uid='sjxs';pwd='123456'";
                string        com     = "select 用户名,用户密码 from 用户表 where 用户名='" + textBox1.Text + "'and 用户密码='" + textBox2.Text + "'";
                SqlConnection connect = new SqlConnection(con);
                connect.Open();
                SqlCommand    cmd    = new SqlCommand(com, connect);
                SqlDataReader reader = cmd.ExecuteReader();
                if (!reader.Read())
                {
                    if (this.textBox1.Text == "" || this.textBox2.Text == "")
                    {
                        MessageBox.Show("账户或密码不为空");
                    }
                    else
                    {
                        MessageBox.Show("用户名或密码错误");
                        this.textBox1.Clear();
                        textBox2.Clear();
                        textBox1.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("用户登录成功!");
                    string yonghu  = this.textBox1.Text;
                    用户     yonghus = new 用户(yonghu);
                    yonghus.Show();

                    this.Hide();
                }
                connect.Close();
            }
        }