Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Failed to enable constraints
Message
 
 
To
11/03/2011 12:37:12
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01503360
Message ID:
01503364
Views:
32
Does your DataSet has properly defined Primary Key?

Also, I believe we discussed this exact error about a month or so ago with you before.

>Hi,
>
>I changed the structure of a table in my SQL Server database and created a new stored procedure (which was a copy/paste/modify of an existing and working SP). This SP gets called to fill a dataset, but I get this error:
>
>Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
>Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
>
>Source Error:
>
>Line 411: {
>Line 412: // Using GetDataSet will replace the DataSet
>Line 413: this.FillDataSet(this.GetCurrentDataSet(),
>Line 414: "PlansSelectByBasePlan");
>Line 415:
>
>PlansSelectByBasePlan is my SP, defined like this:
>
>
CREATE PROCEDURE [dbo].[PlansSelectByBasePlan]
>
>AS
>	SET NOCOUNT ON;
>	SELECT [Code],
>		[CommissionAccount],
>		[CommissionFK],
>		[CurrencyFK],
>		[Description],
>		[EffectiveDate],
>		[IsARider],
>		[IsAWaiver],
>		[MaxAge],
>		[MaxPremium],
>		[MaxSumAssured],
>		[MaxUnits],
>		[MinAge],
>		[MinPremium],
>		[MinSumAssured],
>		[MinUnits],
>		[PlanAccount],
>		[PlanPK],
>		[PlanTypeFK],
>		[UnitsInForce]
>	FROM [dbo].[Plans]
>	WHERE 
>		([IsABasePlan] = 1)
>
>If I run the SP in SSMS it runs and returns the expected data. Any ideas what this problem is?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform