|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataAdapter.Fill orderI have a several DataTables in my XML Schema that are linked using DataRelations (My original Access databse still has the same relations). However when I fill the DataAdapters (I assume in the correct order) I get the following error: Additional information: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. I need to work with the AlloyComposition table, I've filled all parent tables first: daBaseMetalStocks.Fill(dsTurbobraze, "BaseMetalStocks") daBaseMetalAlloy.Fill(dsTurbobraze, "BaseMetalAlloy") daPowderSize.Fill(dsTurbobraze, "PowderSize") daPremadeStocks.Fill(dsTurbobraze, "PremadeStocks") daAlloyComposition.Fill(dsTurbobraze, "AlloyComposition") Why am I getting this? Here's the XML Schema as a printscreen: http://img81.imageshack.us/img81/3697/datasetscreen11lb.jpg And as a file: http://www.mytempdir.com/604239 http://www.filefactory.com/?211f10 Any help appreciated. I've isolated the problem to the AlloyComposition table. If I remove
all relations except the two relations connecting BaseMetalStocks, BaseMetalAlloy and AlloyComposition I still get the error (though if I need to load just the first two it works fine) This is completely bizarre and very very annoying. The problem just
seemed to have solved itself after me messing around with the fill command, deleting and re-adding datarelations. Although I'm pretty sure nothing has changed in my code (it looks the same as the nonworking version, same too with DataRelations). Damn ADO >:| In article <1145358996.855164.104***@g10g2000cwb.googlegroups.com>,
aziz***@googlemail.com says... Show quote > I'm using VB .NET 2003 and Access 2000 Hi Aziz,> > I have a several DataTables in my XML Schema that are linked using > DataRelations (My original Access databse still has the same > relations). However when I fill the DataAdapters (I assume in the > correct order) I get the following error: > Additional information: Failed to enable constraints. One or more rows > contain values violating non-null, unique, or foreign-key constraints. > > I need to work with the AlloyComposition table, I've filled all parent > tables first: > daBaseMetalStocks.Fill(dsTurbobraze, "BaseMetalStocks") > daBaseMetalAlloy.Fill(dsTurbobraze, "BaseMetalAlloy") > daPowderSize.Fill(dsTurbobraze, "PowderSize") > daPremadeStocks.Fill(dsTurbobraze, "PremadeStocks") > daAlloyComposition.Fill(dsTurbobraze, "AlloyComposition") > > Why am I getting this? I know of 2 ways around this problem. One is to fill your DataTables children first. For example, if I read your diagram correctly and BaseMetalStocks is the Parent table, fill BaseMetalAlloy then BaseMetalStocks. The other way is to set the EnforceConstraints property to False, fill the DataTables and then set EnforceConstraints back to True (assuming you want constraints enforced). |
|||||||||||||||||||||||