Failed to enable constraints. One or more rows contain values violating non-null, uni
I Have a Dataset Ive hooked up to a FormView, there is an Error that is occuring within the page and I think it is coming from the Dataset,
Basically it says
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
But Ive checked the database, 3 records cause the error out of 89 (Test Data), each of the three records are different (there are three types with many different features), I've checked all relations and nothing looks out of place, No foreign keys are unreferenced
heres some of the SQL Ive used to look over the records, its meaningless, but ive checked these records over for anything I can think of and have found nothing, How can I capture the exception from the Dataset, to hopefully get a more detailed description of the error.
All the results add up and look just like 3 other random records?
select * From Listing where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From Contact where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From Comment where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From Event where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From Listing_IMages where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From Listing_Category where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89
select * From ListingLink where ilistingOneID = 2 OR ilistingOneID = 60 OR ilistingONeID = 89
select * From ListingLink where ilistingTwoID = 2 OR ilistingTwoID = 60 OR ilistingTwoID = 89
Select * from Trade_Category where EXISTS(
select * From Listing_Category where ilistingID = 2 OR ilistingID = 60 OR ilistingID = 89 and Listing_Category.iCategoryID = Trade_Category.iCategoryID)
I'm having the same problem...
I configured my SQLDatasource with query
SELECT CampaignAllProducts.PID, CampaignAllProducts.Product_Desc, CampaignAllProducts.Version_Id, CampaignAllProducts.Oper_Sys, CampaignAllProducts.Delivery_method, CampaignAllProducts.MSRP, IPID_Family.Family_ID, CampaignAllProducts.Sku, CampaignAllProducts.Product_url, CampaignAllProducts.product_type, CampaignAllProducts.product_level, CampaignAllProducts.product_category, CampaignAllProducts.product_subcategory, CampaignAllProducts.free_paid FROM CampaignAllProducts INNER JOIN IPID_Family ON CampaignAllProducts.Family = IPID_Family.Family ORDER BY CampaignAllProducts.Sku
which I can copy into SQLServer, run directly and I get a couple of hundred rows returned. I can click on Query Builder and Execute Query and I get the same couple of hundred rows returned. However when click on 'Test Query' on the Finish screen, I get 'Failed to enable constraints. One or more rows contain values violating non-null, unique or foreign key constraints.'
Wierd! Why would it resolve fine under Query Builder, and fail on the next screen???!!!
I solved the problem?
crap I forgot I posted this, 6 months straight work with a few days off will do that to you, um I changed the object data source to a SQL datasource and it solved the problem, can't remember what the exact problem was, I think it may have been something to do with varying data type sizes, that the dataset did not accurately reflect. I noticed that when I used a datalist with custom paging function the error was not reflected though the majority of the same data was accessed, which lead me to try a different technique, Im hardly an expert in VB/ASP so you may be able to find a better resolution somewhere else.
I previously worked with PHP and though the code is alot harder to wrangle and filenames had to be case correct Ive never encountered such boggling problems as that in VB/ASP, now I tend to stare clear of Visual Studios automated functions, and prefer to write the code so I know exactly whats going on.
Last edited by Nate1; 12-03-2007 at 07:32 PM.
Thanks, Nate1. I rewrote the query the long way, forgot to take out my SQLDataSource, and it suddenly started working both ways! I checked, and I'm still having the same issue on the SQLDataSource, but it's resolving at execution time, so I'll take it.
So I guess it's not resolved, but no longer a problem. Thanks for your help.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)