0

在 sharepoint 上的我的 asp.net 页面中,当我与另一个用户同时更改数据库时,我收到此错误:

(11/24/2012 3:53:32 PM) - Error Message: Save Conflict.

Your changes conflict with those made concurrently by another user. If you want your changes to be applied, click Back in your Web browser, refresh the page, and resubmit your changes.
Stacktrace:    at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
   at Microsoft.SharePoint.Library.SPRequest.UpdateField(String bstrUrl, String bstrListName, String bstrXML)
   at Microsoft.SharePoint.SPField.UpdateCore(Boolean bToggleSealed)
   at PDF_Library.VisualWebPart1.PDF_Library.import_sections_into_column()
   at PDF_Library.VisualWebPart1.PDF_Library.save_Click(Object sender, EventArgs e)

但是我如何捕捉到这个错误?我试着做

catch (COMException) {

}

但这不起作用...

有谁知道为什么?

4

1 回答 1

1

COMException 由 SharePoint 在 HandleComException 方法中处理。然后,它会引发 Microsoft.SharePoint.SPException 并显示消息“保存冲突”。如果您注意捕获此特定异常类型,请将 catch 块更改为

catch (Microsoft.SharePoint.SPException) {
  // do stuff
}
于 2012-11-24T21:05:35.717 回答