在这里听起来不像是破纪录(有几篇看起来像这样的帖子),但似乎没有一个能解决我的问题。好像要更新的时候
private bool resetPassword(string password)
{
try
{
var db = new SchedulerDBDataContext();
// since this is a instance method, I grab the ID from _this_
AdminUser user = db.AdminUsers.SingleOrDefault(t => t.ID == _ID);
if (user != null)
{
// this method DOES update these two fields.
SchedUtil.md5Hash(password, ref user._EncryptedPassword, ref user._PasswordSalt);
// I threw these in there to try something... it didn't work.
//user._EncryptedPassword = user.EncryptedPassword;
//user._PasswordSalt = user.PasswordSalt;
// this DOESN'T do anything.
db.SubmitChanges();
return true;
}
return false;
}
catch (Exception)
{
return false;
}
}
也许这是一个愚蠢的问题,但我正在this
从数据库中检索......为什么不只是 updatethis
的属性。我想我需要通过DBContext
我猜想。