Thứ Năm, 27 tháng 11, 2008

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

Solution:

1. I have had alot of issues with Visual Studio 2005 and Crystal Reports and this was one of them. You can avoid the error by setting the EnforceConstraints property of your DataSet to False
_SubDataSet2.EnforceConstraints = False

Also if you are using an .xsd file, check the properties and make sure the AllowDBNull property is set to False.

2. Check all the MaxLength property of the columns in your DataTable.

The column that I changed from "nvarchar(512)" to "nvarchar(MAX)" still had the 512 value on the MaxLength property so I changed to "-1" and it works!!.

Hope this helps!

Không có nhận xét nào: