DataSet.MergeFailed
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
public class MainClass {
public static void Main(){
OleDbConnection conn = new OleDbConnection();
string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Northwind.mdb";
conn.ConnectionString = strDSN;
conn.Open();
string sql = "SELECT * FROM orders ";
OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);
DataSet ds1 = new DataSet("ds1");
da.Fill(ds1);
sql = "SELECT * FROM Customers ";
da = new OleDbDataAdapter(sql, conn);
DataSet ds2 = new DataSet("ds2");
da.Fill(ds2);
ds1.MergeFailed += new MergeFailedEventHandler(OnMergeFailed);
ds1.Merge(ds2);
}
protected static void OnMergeFailed (object sender, MergeFailedEventArgs args)
{
MessageBox.Show(args.Conflict.ToString());
}
}
Related examples in the same category