//修改 private void btnMod_Click(object sender, EventArgs e) { DGVSelect(); if (tboxXh.Text.Trim() == "" || tboxName.Text.Trim() == "" || tboxPwd.Text.Trim() == "" || tboxTel.Text.Trim() == "") { MessageBox.Show("信息不能为空!"); return; } string Gender = cboxGender.Text; //密码md5加密 MD5 md5 = new MD5CryptoServiceProvider(); byte[] palindata = Encoding.Default.GetBytes(tboxPwd.Text.Trim()); //将要加密的字符串转换为字节数组 byte[] encryptdata = md5.ComputeHash(palindata); //将字符串加密后也转换为字符数组 string userPwd = Convert.ToBase64String(encryptdata); //将加密后的字节数组转换为加密字符串 User u = new User(tboxXh.Text.Trim(), tboxName.Text.Trim(), userPwd, Gender, tboxTel.Text.Trim(), int.Parse(tboxCorID.Text), id); if (AdminManage.ModUserMes(u)) { MessageBox.Show("修改成功!"); button5_Click(sender, e); } else { MessageBox.Show("修改失败!"); } }