共用方式為


ApplyChangeFailed 事件

當資料列無法在伺服器上套用之後發生。

命名空間:  Microsoft.Synchronization.Data.Server
組件:  Microsoft.Synchronization.Data.Server (在 Microsoft.Synchronization.Data.Server.dll 中)

語法

'宣告
Public Event ApplyChangeFailed As EventHandler(Of ApplyChangeFailedEventArgs)
'用途
Dim instance As DbServerSyncProvider
Dim handler As EventHandler(Of ApplyChangeFailedEventArgs)

AddHandler instance.ApplyChangeFailed, handler
public event EventHandler<ApplyChangeFailedEventArgs> ApplyChangeFailed
public:
 event EventHandler<ApplyChangeFailedEventArgs^>^ ApplyChangeFailed {
    void add (EventHandler<ApplyChangeFailedEventArgs^>^ value);
    void remove (EventHandler<ApplyChangeFailedEventArgs^>^ value);
}
member ApplyChangeFailed : IEvent<EventHandler<ApplyChangeFailedEventArgs>,
    ApplyChangeFailedEventArgs>

備註

如果在同步處理期間無法套用某個資料列,就會引發 ApplyChangeFailed 事件。ApplyChangeFailedEventArgs 物件會提供有關造成失敗之錯誤或衝突的資訊。在此事件的處理常式中,您可以透過幾種方式來回應此事件,其中包括指定同步處理提供者是否應該再次嘗試套用此資料列。如需詳細資訊,請參閱 HOW TO:使用事件和程式商務邏輯HOW TO:處理資料衝突和錯誤

範例

下列程式碼範例會針對 ApplyChangeFailed 事件指定事件處理常式。呼叫的方法會記錄資訊,為用戶端和伺服器同步處理提供者分隔檔案。若要在完整範例的內容中檢視這段程式碼,請參閱 HOW TO:使用工作階段變數

this.ApplyChangeFailed += new EventHandler<ApplyChangeFailedEventArgs>(EventLogger.LogEvents);
else if (e is ApplyChangeFailedEventArgs)
{

    ApplyChangeFailedEventArgs args = (ApplyChangeFailedEventArgs)e;
    outputText.AppendLine("** APPLY CHANGE FAILURE AT " + site.ToUpper() + " **");
    outputText.AppendLine("Table for which failure occurred: " + args.TableMetadata.TableName);
    outputText.AppendLine("Error message: " + args.Error.Message);

}
AddHandler Me.ApplyChangeFailed, AddressOf EventLogger.LogEvents
ElseIf TypeOf e Is ApplyChangeFailedEventArgs Then

    Dim args As ApplyChangeFailedEventArgs = CType(e, ApplyChangeFailedEventArgs)
    outputText.AppendLine("** APPLY CHANGE FAILURE AT " & site.ToUpper() & " **")
    outputText.AppendLine("Table for which failure occurred: " & args.TableMetadata.TableName)
    outputText.AppendLine("Error message: " & args.Error.Message)

請參閱

參考

DbServerSyncProvider類別

DbServerSyncProvider 成員

Microsoft.Synchronization.Data.Server 命名空間