Re: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.



On Mar 17, 3:26 am, "Rad [Visual C# MVP]" <nos...@xxxxxxxxxx> wrote:
On 15 Mar 2007 21:05:27 -0700, nadeem_...@xxxxxxxxx wrote:





Hello Everyone,

We have a .net application (1.1 Framework) that uses a strongly typed
dataset.
The application is in production for over 2 years.

Oneof the users recently reported that when he tried starting the
app. in the morning itfailedand the logs showed the following error
details. After like 10 minutes or so he double clicks the app. and it
starts up with no errors.

I have tried searching on this issue and most of the threads\articles
discuss this issue in development environment. Has anyonefaced this
issue in production environment and most of all how to fix this
strange error.?.

The Typed dataset in question has two table only in a Master-Detail
relationship.

Source: System.Data
Message:Failedtoenableconstraints.Oneormorerowscontainvalues
violatingnon-null,unique, orforeign-keyconstraints.
Stack Trace: at System.Data.DataSet.FailedEnableConstraints()
at System.Data.DataSet.EnableConstraints()
at System.Data.DataSet.set_EnforceConstraints(Boolean value)
at System.Data.DataTable.EndLoadData()
at System.Data.Common.DbDataAdapter.FillFromReader(Object data,
String srcTable, IDataReader dataReader, Int32 startRecord, Int32
maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data,
Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Company.DataLayer.API.Database.CreateTradeCache(String
ProductID, String reportID)
at Company.DataLayer.API.Database.CreateReportCache(String
ProductID, String reportID)
at Company.DataLayer.API.Database.CreateUserCache(String userName)
at Company.DataLayer.API.Database.Login(String userName, Boolean
NotificationRequired)

Any help will be appreciated.

Nadeem

That error is pretty much as simple as it sounds ... some of the data being
pushed into the dataset violatesoneormoreof theconstraints--foreignkeyor not null.

In your application logic do you make use of transactions? Perhaps the
problem is due to the fact that some complicated transaction has only been
partially completed, or some user input is simply invalid
--
Bits.Byteshttp://bytes.thinkersroom.com- Hide quoted text -

- Show quoted text -


Hi Marina\Rad,

This is a windows app. The queries are running in the data tier.

And no, there are no transactions involved in this part of the code.
Here is how its working

1. We have a Trade and products in a trade.
2. We clear out the product detials table.
3. Clear out the trade table.
4. run the select on the trade table to get all the trades.
5. run the select to get all the products for each trade.

Also please note, we have a highly controlled production environment.
All this happened in the morning when the user tried to load the app.

Hope this is helpful.

Thanks,

Nad

.



Relevant Pages

  • Re: Failed to enable constraints. One or more rows contain values violating non-null, unique, or
    ... The application is in production for over 2 years. ... String srcTable, IDataReader dataReader, Int32 startRecord, Int32 ... Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand ... command, CommandBehavior behavior) ...
    (microsoft.public.dotnet.framework.adonet)
  • Failed to enable constraints. One or more rows contain values violating non-null, unique, or for
    ... The application is in production for over 2 years. ... String srcTable, IDataReader dataReader, Int32 startRecord, Int32 ... Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand ... command, CommandBehavior behavior) ...
    (microsoft.public.dotnet.framework.adonet)
  • NO_DATA - no error information available
    ... intermittently in production, and in this case the only diffence between ... IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: The curse of constant fields
    ... production branch, EAR construction etc) for a reasonably important J2EE app I am pretty fanatic about sanitizing everything prior to an official build. ... our environment it would be unrealistic. ... Because a lot of time can be wasted if a tester reports that an error is still there, and then it's a question of is the error still there because the build is flawed, or because the developer who "fixed" it only fixed it for a different use case or in his own development environment. ...
    (comp.lang.java.programmer)
  • Re: social credit in one country
    ... liquidity only for domestic output of production ... otherwise international trade orgs will slam down on ... In respect to the retail credit, ... differentiate will be, in effect, 'exporting' part of ...
    (sci.econ)