BeginLoadData?????

Sep 18 2008 12:00 AM
The following code is supposed to be comparing two datasets and then load the rows that are not duplicates into a third datatable.Instead it repeats the rows that are already in the database(making more duplicates).Could someone tell me what i am doing wrong.

foreach (DataRow parentrow in dsImport.Tables[2].Rows)
{
DataRow[] childrows = parentrow.GetChildRows(r);
if (childrows == null || childrows.Length == 0)
dtImport.LoadDataRow(parentrow.ItemArray, true);
}

foreach (DataRow databaseRow in dsImport.Tables["StudentModule"].Rows)
{
foreach (DataRow spreadRow in dsImport.Tables["Sheet1$"].Rows)
{
if (spreadRow != databaseRow)
{
dtImport.BeginLoadData();
}
}
}

}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return dtImport