新增用户保存失败:提示并发错误

解决方案:
1. tb_MyUser 表 Model 的Account字段要设置为主键!
2. 替换frmUser.DoSave方法
C# Code:
[ORM_FieldAttribute(SqlDbType.NVarChar, 30, false, true, true, false, false)]
public static string Account = "Account";
[ORM_FieldAttribute(SqlDbType.NVarChar, 30, false, true, true, false, false)]
public static string Account = "Account";
C# Code:
public override void DoSave(IButtonInfo sender)
{
try
{
UpdateLastControl();
_BLL.DataBinderRow.EndEdit();
if (!ValidatingData(_BLL.DataBinderRow)) return;
if (UpdateType.Add == _UpdateType)
_BLL.DataBinderRow[tb_MyUser.Password] = CEncoder.Encode(txtPassword2.Text);
bool ret = _BLL.Update(_UpdateType);//提交数据
if (ret)
{
UpdateSummaryRow(_BLL.DataBinderRow); //刷新表格内的数据.
base.DoSave(sender);
Msg.ShowInformation("保存成功!");
}
else
Msg.Warning("保存失败!");
}
catch (Exception ex)
{
Msg.ShowException(ex);
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
public override void DoSave(IButtonInfo sender)
{
try
{
UpdateLastControl();
_BLL.DataBinderRow.EndEdit();
if (!ValidatingData(_BLL.DataBinderRow)) return;
if (UpdateType.Add == _UpdateType)
_BLL.DataBinderRow[tb_MyUser.Password] = CEncoder.Encode(txtPassword2.Text);
bool ret = _BLL.Update(_UpdateType);//提交数据
if (ret)
{
UpdateSummaryRow(_BLL.DataBinderRow); //刷新表格内的数据.
base.DoSave(sender);
Msg.ShowInformation("保存成功!");
}
else
Msg.Warning("保存失败!");
}
catch (Exception ex)
{
Msg.ShowException(ex);
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898


扫一扫加作者微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网