//登录按钮点击事件 private void login_btn_Click(object sender, EventArgs e) { if (username_txb.Text != "" && password_txb.Text != "") { //查询数据库admin表 cmd = new MySqlCommand(); cmd.CommandText = string.Format("select count(*) from admin where binary username= '******' and binary password= '******' "); conn = Program.ConDataBase(); cmd.Connection = conn; //判断用户名和密码是否正确 if (Convert.ToInt32(cmd.ExecuteScalar()) == 0) { MessageBox.Show(LoadForm.TextList[5]); } else { MessageBox.Show(LoadForm.TextList[6]); cmd.Dispose(); conn.Close(); MainSurface mainSurface = new MainSurface(); mainSurface.Show(); this.Visible = false; } } else { MessageBox.Show(LoadForm.TextList[7]); } }