Reputation: 43893
In my asp.net page on sharepoint, when I make changes to the database, at same time as another user, I get this error:
(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)
But How do I catch this error? I tried doing
catch (COMException) {
}
but this isn't working...
Does anyone know why?
Upvotes: 0
Views: 331
Reputation: 10230
The COMException is handled by SharePoint in the HandleComException method. It then throws an Microsoft.SharePoint.SPException with the message "Save Conflict". If you watch to catch this specific exception type, change the catch block to
catch (Microsoft.SharePoint.SPException) {
// do stuff
}
Upvotes: 1