Example #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     last = new 功能选择();
     this.Hide();
     last.ShowDialog();
     Application.ExitThread();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            OracleConnection conn     = new OracleConnection(connStr);
            string           checksql = "update UP set username = :uname, passwd = :upasswd where FLAG = 'admin'";

            try
            {
                conn.Open();
                OracleCommand cmd = new OracleCommand(checksql, conn);
                cmd.Parameters.Add(":uname", OracleDbType.Varchar2, 18).Value   = luser.Text.Trim();            //账号
                cmd.Parameters.Add(":upasswd", OracleDbType.Varchar2, 18).Value = lpasswd.Text.Trim();          //密码
                cmd.ExecuteNonQuery();

                MessageBox.Show("密码已修改");
            }
            catch
            {
                MessageBox.Show("密码修改失败!");
            }
            finally
            {
                conn.Close();                                               //关闭数据库连接
            }


            gn = new 功能选择();
            this.Hide();
            gn.ShowDialog();
            Application.ExitThread();
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            flag = 0;
            OracleConnection conn     = new OracleConnection(connStr);
            string           checksql = "select username, passwd From UP";

            try
            {
                conn.Open();
                OracleCommand    cmd    = new OracleCommand(checksql, conn);
                OracleDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string user   = reader["username"].ToString();
                    string passwd = reader["passwd"].ToString();
                    if (user.Trim() == luser.Text.ToString().Trim() && passwd.Trim() == lpasswd.Text.ToString().Trim())
                    {
                        flag = 1; break;
                    }
                    else
                    {
                        flag = 0;
                    }
                }
            }
            catch
            {
                label3.Text = "*账号或密码有误!请重新输入!";
            }
            finally
            {
                conn.Close();
            }
            if (flag == 1)
            {
                uchose = new 功能选择();
                this.Hide();
                uchose.ShowDialog();
                Application.ExitThread();
            }

            else
            {
                label3.Text = "*账号或密码有误!请重新输入!";
            }
        }