Search:
Namespaces
Discussions
.NET v1.1
Feedback
Failed to enable contraints error?
Messages
Related Types
This message was discovered on
microsoft.public.dotnet.framework.adonet
.
Post a new message to this list...
Steve Dussinger
Can someone give me some idea what this error means?
Failed to enable constraints. One or more rows contain values
violating non-null, unique, or foreign-key constraints.
I have exactly one row in my database table. The table is as follows:
Column Type Size Allows Nulls
userId int 4 bytes F <--- Key Field
userName char 10 bytes T
userPassword char 10 bytes T
Since there is only one row in the table I'm pretty sure that I can't
possibly be vioating any UNIQUE constraints, and since I only have one
table there sure aren't any foreign keys set up either, so I have to
assume that its a null constraint. But there are no null entries in
the one row in this table.
I select the one row in my database using an ADO.NET dataset (from an
ASP.NET page) and I get this error.
The row in my database is as follows:
userId = 1
userName = myname
userPassword = mypassword.
I can see the contents of my database by using the SQL Server
Enterprise Manager and it shows exactly what I expect, but still I get
this error.
Anyone know what the problem is here?? I'm tearing my hair out on
this.
Thanx,
Steve
Reply to this message...
Hussein Abuthuraya(MSFT)
Steve,
You included good describtion of the problem but you didn't list the code that caused this error. Can you post the minimum code that recreates the problem indicating what
line of code caused this error?
Also, indicate if this is a SQL Server database or something else.
Thanks,
Hussein Abuthuraya
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
Reply to this message...
Steve Dussinger
Hussein:
Thanx for the reply, but I figured it out. The problem was my not
understanding the difference between a strongly-typed
DataSet
vs a
non-typed
DataSet
.
It turns out that I was modifying the select statement so that it was
only returning some of the columns from the table, and that caused a
conflict with the non-null constraints defined in the table.
Changing the select statement to return all of the columns in the table
solved the problem.
--Steve
*** Sent via Developersdex
http://www.developersdex.com
***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
System.Data.DataSet
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com