Wrapping your Hands around the Throat of EnforceConstraints

Do enforced constraints have you down?  They did for me today.  I was getting the following error as I set EnforceConstraints on a freshly filled DataSet to true.

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

I found this to be annoying.  Actually, “annoying “is the polite word that I use when I find error messages to be useless in debugging.  This annoyance continued until I was pointed at this blog entry by my colleague Dave Lloyd.  Since it's his blog, it figures that he would know about it :).  It contains a code snippet can is quite handy in tracking down the source of this particular error message.  Very useful if you too need to tame the enforced constraints beast.