Re: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
- From: nadeem_far@xxxxxxxxx
- Date: 19 Mar 2007 19:40:12 -0700
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
.
- Follow-Ups:
- References:
- Prev by Date: Re: How do i move an SQLDatabase to another location?
- Next by Date: Re: How do i move an SQLDatabase to another location?
- Previous by thread: Re: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
- Next by thread: Re: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
- Index(es):
Relevant Pages
|