[code:c#]
public string GetErrors(DataTable table)
{
StringBuilder s = new StringBuilder();
// Test if the table has errors. If not, skip it.
if (table.HasErrors)
{
// Print the error of each column in each row.
foreach (DataRow row in table.GetErrors())
{
foreach (DataColumn column in table.Columns)
{
s.Append(column.ColumnName + "-" + row.GetColumnError(column));
}
// Clear the row errors
row.ClearErrors();
}
}
return s.ToString();
}
[/code]