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 は、HandleComException メソッドで SharePoint によって処理されます。次に、"Save Conflict" というメッセージと共に Microsoft.SharePoint.SPException をスローします。この特定の例外の種類をキャッチするために監視する場合は、catch ブロックを次のように変更します。

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