Exemple #1
0
 private void RegistButton_Click(object sender, EventArgs e)
 {
     number   = NumberTextbox.Text;
     password = PasswordTextbox.Text;
     if (number == "" || password == "")
     {
         ErrorLabel.Text = "请输入注册学号或密码";
     }
     else
     {
         SQLiteDataReader sdrLogin = MySQLiteClass.Getmysqlread("select Number from Login where Number='" + number + "'");
         sdrLogin.Read();
         if (sdrLogin.HasRows)
         {
             sdrLogin.Dispose();
             ErrorLabel.Text = "该学号已注册";
         }
         else
         {
             MySQLiteClass.Getmysqlcom("insert into Login(Number,Password) values('" + number + "','" + password + "')");
             ErrorLabel.Text = "注册成功";
         }
     }
     NumberTextbox.Text   = "";
     PasswordTextbox.Text = "";
 }
Exemple #2
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     number   = NumberTextbox.Text;
     password = PasswordTextbox.Text;
     if (number == "" || password == "")
     {
         ErrorLabel.Text = "请输入学号或密码";
     }
     else
     {
         SQLiteDataReader sdrLogin = MySQLiteClass.Getmysqlread("select Password from Login where Number ='" + number + "'");
         sdrLogin.Read();
         if (sdrLogin.HasRows)
         {
             if (password != sdrLogin["Password"].ToString())
             {
                 ErrorLabel.Text = "请输入正确的学号和密码";
             }
             else
             {
                 sdrLogin.Dispose();
                 MySQLiteClass.sqlClose(MySQLiteClass.Getsqlitecon());
                 ErrorLabel.Text          = "欢迎回来,学员" + number;
                 BGpictureBox.Visible     = true;
                 Logoutbutton.Visible     = true;
                 Scorebutton.Visible      = true;
                 NumberLabel.Visible      = false;
                 NumberTextbox.Visible    = false;
                 PasswordLabel.Visible    = false;
                 PasswordTextbox.Visible  = false;
                 passwordCheckBox.Visible = false;
                 LoginButton.Visible      = false;
                 RegistButton.Visible     = false;
             }
         }
         else
         {
             ErrorLabel.Text = "请输入正确的学号和密码";
         }
     }
     NumberTextbox.Text   = "";
     PasswordTextbox.Text = "";
 }