请问有人可以帮我解决上述问题吗?我在我的项目中使用 SimpleData 并尝试如下更新记录,但出现上述错误。
var releasedHosts = show_crm.tblName.Update(ID: Id, ID: newId);
错误信息:
命名参数“ID”不能多次指定
谢谢你。
代码片段
string siteName = ddlDeleteSite.SelectedItem.Text;
if (!siteName.Equals("Unknown-Site") && siteName != null)
{
int siteId = Convert.ToInt32(ddlDeleteSite.SelectedValue);
//Update record to Attach Hostname to selected site by updating it's SiteID and remove it from 'Unknown-Site'
var updatedSite = show_crm.tblSites.UpdateBySiteID(SiteID: siteId, Deleted: true);
if (updatedSite != null)
{
var unknownSite = show_crm.tblSites.FindBySiteName("Unknown-Site");
int unknownSiteId = unknownSite.SiteID;
var releasedHosts = show_crm.tblHostNames.Update(new { SiteID = unknownSiteId }, new { SiteID = siteId });//(show_crm.tblHostNames.SiteID == siteId, SiteID: unknownSiteId);
}
lblDeleteSiteStatus.Text = ddlDeleteSite.SelectedItem.Text + " deleted successfully.";
lblDeleteSiteStatus.Visible = true;
RetrieveSites(ddlDeleteSite);
}