Gridview has "Failed to enable constraints" error...
Posted on 2008-10-13
I have a gridview that is databound to an objectdatasource. The ODS utilizes a XSD Dataset that was created.
I keep getting this error when viewing the page: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
The query (MySQL) works fine thru the query tool.
I MANUALLY checked the data and it is fine as well.
Here's the actual query...
SELECT DISTINCT companytypes.CompanyType, users.Company, users.CompanyTypeId, users.ContactAddress1, users.ContactAddress2, users.ContactCity,users.ContactState, users.ContactZip, users.ContactPhone, users.ContactFax, users.CompanyDescription
FROM users INNER JOIN companytypes ON users.CompanyTypeId = companytypes.CompanyTypeId
ORDER BY companytypes.CompanyType, users.Company
When I create a MySqlDataSource (using DevArt's MyDirect.NET) and bind the gridview directly to it, putting the exact same SQL, it works fine.