DataSet “Failed to enable constraints. One or more rows contain values….”
November 3rd, 2004 by alpriest
Loading several DataTables into a DataSet using DataRelations when there are invalid constraints causes the error message “Failed to enable constraints. One or more rows contain values….”.
Solution is documented here
foreach (DataTable dt in dataset.Tables)
{
if (dt.HasErrors)
{
Console.WriteLine("ERRORS IN : " + dt.TableName);
foreach (DataRow dr in dt.GetErrors())
{
Console.WriteLine(dr.RowError);
}
}
}