Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Failed to enable constraints
Message
 
 
À
11/03/2011 12:37:12
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01503360
Message ID:
01503364
Vues:
36
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform