亚音速 3.0 更新现有记录时出现问题
private Boolean Saveuser(bool isNew)
{
tb_User user = new tb_User();
user.User_Name = txtUserName.Text.Trim();
user.User_LoginName = txtLoginName.Text;
user.User_Password = txtPassord.Text;
user.User_ModifiedBy = clsGlobalVariable.strusername;
user.User_Modified = DateTime.Now;
user.User_IsDeleted = false;
user.User_IsUpdated = true;
user.User_UserGroup = "";
user.User_UserType = "";
user.User_WarehouseCode = "";
user.SetIsNew(isNew);
user.Save();
}
当我尝试使用上面的编码插入新用户时,这是可行的,但尝试通过传递 isNew (false) 来更新现有用户。它不起作用,当我在 activerecord.cs 内部跟踪时,新建和更新的脏列计数始终为 0。如何更新现有记录? 请帮我回答一下? 谢谢。
private Boolean Saveuser(bool isNew)
{
tb_User user = new tb_User();
user.User_Name = txtUserName.Text.Trim();
user.User_LoginName = txtLoginName.Text;
user.User_Password = txtPassord.Text;
user.User_ModifiedBy = clsGlobalVariable.strusername;
user.User_Modified = DateTime.Now;
user.User_IsDeleted = false;
user.User_IsUpdated = true;
user.User_UserGroup = "";
user.User_UserType = "";
user.User_WarehouseCode = "";
user.SetIsNew(isNew);
user.Save();
}
when I try to insert new user using above coding, it is worik, but try to update existing user by passing isNew (false). It is not working, when I trace inside activerecord.cs, the dirty column count is always 0 for both new and update. How can I update the existing record?
Please answer for me?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该
保存
用户 u = User.FetchByID(2345);
u.User_Name = "blablabla";
//其他用户对象修改...
u.Save();
You should
Save
User u = User.FetchByID(2345);
u.User_Name = "blablabla";
//other User object modifications...
u.Save();