Prompt for running the project today"Constraints cannot be enabled. One or more rows contain values that violate non-null, unique, or foreign key constraints ." .
I found some reason online: http://www.cnblogs.com/muzihai1988/archive/2011/05/04/2036502.html
Cause analysis:The query results of a strongly typed able and SQL statement do not match. In short, a strongly typed able has more data columns than the result set queried by SQL statements, or this attribute does not match.
The unique, non-empty, and foreign key constraints of the table used are checked for the error message, and no exception is found. Therefore, the relevant information is queried online. The following methods are provided:
- the field attribute in datatable is inconsistent with the field attribute in the table, leading to the failure to enable the constraint. modification method: Find ***. the field in the XSD file that corresponds to the table modification, click the attribute of this field ---- the maximum length is equal to the maximum length after the modified field of your data table I thought about it. I did modify a word yesterday. Segment length, and then find the corresponding automatic in XSD, change the length to the new length, and then the error will not appear.
- In. find the problematic table in the XSD file, use the Shift key with the mouse to select all columns, press delete to delete, right-click the table header, and select "configuration" in the menu ", click "finish" to generate a new forced datetable. The premise of using the preceding method is that the SQL statement in the selectcommand command is similar to the select * from Table statement. If no wildcard is used, you have to modify the SQL statement and then generate a strongly typed able.(This method is not used. An error may be prompted during deletion and cannot be deleted. For more information, seeAttachment)
Attachment: the following error may be prompted during deletion:
This indicates that there is a problem with the database connection. Solution: restart vs, do not open the project, select connect to database in tools to connect to the database, and then open the project.