コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text != txtPasswordAgain.Text)
            {
                MessageBox.Show("两次密码输入的不相同哦");
            }
            else
            {
                using (SqlConnection SQLConn = new SqlConnection(ConnStr))
                {
                    string SQLStr      = $"UPDATE accNum SET password = {txtPassword.Text} WHERE accNumber = '{登录界面.MName}'";
                    int    Resultcount = SQLHelper.SQLExcuteNoQuery(SQLStr);

                    if (Resultcount > 0)
                    {
                        MessageBox.Show("更改成功");
                        //返回操作界面
                        操作 operating = new 操作();
                        this.Hide();
                        operating.ShowDialog();
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("更改失败");
                    }
                }
            }
        }
コード例 #2
0
        private void btnReturn_Click(object sender, EventArgs e)
        {
            操作 operating = new 操作();

            this.Hide();
            operating.ShowDialog();
            this.Dispose();
        }
コード例 #3
0
 private void btnLogIn_Click(object sender, EventArgs e)
 {
     using (SqlConnection SQLConn = new SqlConnection(ConnStr))
     {
         string SQLStr = $"select * from accNum where accNumber = '{txtAccountNnumber.Text}'";
         using (SqlCommand SQLCmd = new SqlCommand(SQLStr, SQLConn))
         {
             SQLConn.Open();
             int Resultcount = Convert.ToInt32(SQLCmd.ExecuteScalar());
             if (Resultcount > 0)
             {
                 //MessageBox.Show("登陆成功");
                 string SQLStr1 = $"select * from accNum where accNumber = '{txtAccountNnumber.Text}'and password='******'";
                 using (SqlConnection SQLConn1 = new SqlConnection(ConnStr))
                 {
                     using (SqlCommand SQLCmd1 = new SqlCommand(SQLStr1, SQLConn1))
                     {
                         SQLConn1.Open();
                         int Resultcount1 = Convert.ToInt32(SQLCmd1.ExecuteScalar());
                         if (Resultcount1 > 0)
                         {
                             MessageBox.Show("登陆成功");
                             MName = txtAccountNnumber.Text;
                             操作 operating = new 操作();
                             this.Hide();
                             operating.ShowDialog();
                             this.Dispose();
                         }
                         else
                         {
                             MessageBox.Show("密码错误");
                         }
                     }
                 }
             }
             else
             {
                 MessageBox.Show("账号错误");
             }
         }
     }
 }