Пример #1
0
        /// <summary>
        /// 管理员登录
        /// </summary>
        private void manager_login()
        {
            if (this.namebox.Text != "admin")
            {
                return;
            }
            string connString = Properties.Settings.Default.User_pasConnectionString;
            string sql        = "select password from teacher where name='" + this.namebox.Text + "'";

            using (SqlConnection conn = new SqlConnection(connString))
            {
                try
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand(sql, conn);
                    temp = cmd.ExecuteScalar().ToString();
                }
                catch
                {
                }
            }
            if (this.pswbox.Text != temp)
            {
                MessageBox.Show("密码错误!"); return;
            }
            manager admin = new manager();

            admin.Owner = this;
            admin.Show();
            this.Visible = false;
        }
Пример #2
0
        /// <summary>
        /// 管理员登录
        /// </summary>
        private void manager_login()
        {
            if (this.namebox.Text != "admin") return;
            string connString = Properties.Settings.Default.User_pasConnectionString;
            string sql = "select password from teacher where name='" + this.namebox.Text + "'";
            using (SqlConnection conn = new SqlConnection(connString))
            {
                try
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand(sql, conn);
                    temp = cmd.ExecuteScalar().ToString();
                }
                catch
                {

                }
            }
            if (this.pswbox.Text != temp) { MessageBox.Show("密码错误!"); return; }
            manager admin = new manager();
            admin.Owner = this;
            admin.Show();
            this.Visible = false;
        }