[ Team LiB ] Previous Section Next Section

22.5 Events Reference

MergeFailed

MergeFailedEventHandler MergeFailed;

The MergeFailed event is raised during a Merge( ) operation when the target table and source table contain a column with the same name but differing data types or when the source and target tables have primary keys defined on different columns.

Example

The following code demonstrates how to handle the MergeFailed event:

DataSet ds = new DataSet();
ds.MergeFailed += new MergeFailedEventHandler(ds_MergeFailed);

private void ds_MergeFailed(object sender, MergeFailedEventArgs e)
{
    MessageBox.Show("Failure in table: " + e.Table + Environment.NewLine +
        "Conflict = " + e.Conflict);
}

Notes

The event handler receives an argument of type MergeFailedEventArgs containing properties that provide specific information about the event as described in Table 22-17.

Table 22-17. MergeFailedEventArgs properties

Property

Description

Conflict

Gets the description of the merge conflict.

Table

Gets the DataTable object.

    [ Team LiB ] Previous Section Next Section