Really Anoying problem

M

MadCrazyNewbie

Hey Group,

I`ve got this Anoying problem, and was wondering if somebody would be so
kind as to help me?

I keep getting "Failed to Enable Constraints. One or more rows contain
values wiolating non-null, unique, or foreign-key contraints". When I click
ok, my Datatable has a Red Exlimation mark next to my rows, if i move over
trhis i get a error saying "Foreign Key Contraint "SiteArcirsUsers" Requires
the Child Key Value (1) to exsist in the Parent Table"

Here is my Code I use to fill my DataSet:

cmDsArcirisUsers = BindingContext(dsArcirisUsers, "ArcirisUsers")
mlLoading = True
'Start of Fill Datasets
Try
dsPasswordList.EnforceConstraints = False
Try
Me.odcPasswordLists.Open()
Me.odaArcirisUsers.Fill(dsArcirisUsers)
'Me.odaArcirisRoles.Fill(dsArcirisUsers)
'Me.odaBomAccess.Fill(dsArcirisUsers)
'Me.odaSites.Fill(dsArcirisUsers)
Catch fillException As System.Exception
Throw fillException
Finally
dsPasswordList.EnforceConstraints = True
Me.odcPasswordLists.Close()
End Try
Catch eLoad As System.Exception
System.Windows.Forms.MessageBox.Show(eLoad.Message)
Finally
mlLoading = False
End Try
'End of Fill Datasets
End Sub

And here is my XML Schema:

<?xml version="1.0" standalone="yes" ?>
<xs:schema id="dsArcirisUsers"
targetNamespace="http://www.tempuri.org/dsArcirisUsers.xsd"
xmlns:mstns="http://www.tempuri.org/dsArcirisUsers.xsd"
xmlns="http://www.tempuri.org/dsArcirisUsers.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="dsArcirisUsers" msdata:IsDataSet="true"
msdata:Locale="en-GB">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="ArcirisRoles">
<xs:complexType>
<xs:sequence>
<xs:element name="ArcirisRolesID" msdata:AutoIncrement="true"
type="xs:int" />
<xs:element name="Roles" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ArcirisUsers">
<xs:complexType>
<xs:sequence>
<xs:element name="ArcirisRolesID" type="xs:int" minOccurs="0" />
<xs:element name="ArcirisUsersID" msdata:AutoIncrement="true"
type="xs:int" />
<xs:element name="BomAccessID" type="xs:int" minOccurs="0" />
<xs:element name="BomUsersName" type="xs:string" minOccurs="0" />
<xs:element name="Notes" type="xs:string" minOccurs="0" />
<xs:element name="Password" type="xs:string" minOccurs="0" />
<xs:element name="POSID" type="xs:double" minOccurs="0" />
<xs:element name="SetupDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="SitesID" type="xs:int" minOccurs="0" />
<xs:element name="Usersname" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="BomAccess">
<xs:complexType>
<xs:sequence>
<xs:element name="AccessLevel" type="xs:string" minOccurs="0" />
<xs:element name="BomAccessID" msdata:AutoIncrement="true"
type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Sites">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" minOccurs="0" />
<xs:element name="E-Mail" type="xs:string" minOccurs="0" />
<xs:element name="Fax" type="xs:string" minOccurs="0" />
<xs:element name="Postcode" type="xs:string" minOccurs="0" />
<xs:element name="Site" type="xs:string" minOccurs="0" />
<xs:element name="SitesID" msdata:AutoIncrement="true" type="xs:int"
/>
<xs:element name="Tel" type="xs:string" minOccurs="0" />
<xs:element name="Town" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:primaryKey="true">
<xs:selector xpath=".//mstns:ArcirisRoles" />
<xs:field xpath="mstns:ArcirisRolesID" />
</xs:unique>
<xs:unique name="ArcirisUsers_Constraint1"
msdata:ConstraintName="Constraint1" msdata:primaryKey="true">
<xs:selector xpath=".//mstns:ArcirisUsers" />
<xs:field xpath="mstns:ArcirisUsersID" />
</xs:unique>
<xs:unique name="BomAccess_Constraint1"
msdata:ConstraintName="Constraint1" msdata:primaryKey="true">
<xs:selector xpath=".//mstns:BomAccess" />
<xs:field xpath="mstns:BomAccessID" />
</xs:unique>
<xs:unique name="Sites_Constraint1" msdata:ConstraintName="Constraint1"
msdata:primaryKey="true">
<xs:selector xpath=".//mstns:Sites" />
<xs:field xpath="mstns:SitesID" />
</xs:unique>
<xs:keyref name="ArcirisRolesArcirisUsers" refer="mstns:Constraint1"
msdata:AcceptRejectRule="Cascade" msdata:DeleteRule="Cascade"
msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:ArcirisUsers" />
<xs:field xpath="mstns:ArcirisRolesID" />
</xs:keyref>
<xs:keyref name="BomAccessArcirisUsers"
refer="mstns:BomAccess_Constraint1" msdata:AcceptRejectRule="Cascade"
msdata:DeleteRule="Cascade" msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:ArcirisUsers" />
<xs:field xpath="mstns:BomAccessID" />
</xs:keyref>
<xs:keyref name="SitesArcirisUsers" refer="mstns:Sites_Constraint1"
msdata:AcceptRejectRule="Cascade" msdata:DeleteRule="Cascade"
msdata:UpdateRule="Cascade">
<xs:selector xpath=".//mstns:ArcirisUsers" />
<xs:field xpath="mstns:SitesID" />
</xs:keyref>
</xs:element>
</xs:schema>

Anoybody got any Ideas?

Many Many Thanks
MCN
 
M

MadCrazyNewbie

Cor,

I`ve figured this one out, it was so obvious aswell, i bet you will kick
youself, i sure did:-

I was filling the Child table first then filling my Parent tables, swapped
it round so it filled my parent table first the my child tables, and now its
fine.

Just thought I would let ya know

Ta
Si
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top