Results 1 to 7 of 7

Thread: DataReleation Error!

  1. #1

    Thread Starter
    Lively Member adsc's Avatar
    Join Date
    Nov 2002
    Location
    Kuwait
    Posts
    71

    DataReleation Error!

    Hi All,

    I am getting this error :
    (Additional information: This constraint cannot be enabled as not all values have corresponding parent values.)

    And I’m creating this relation
    Dim relMemberNat As DataRelation
    relMemberNat = New DataRelation("MemNat", myDS.Tables("Nat").Columns("Code"), myDS.Tables("Member").Columns("Nationality"))
    myDS.Relations.Add(relMemberNat)

    - “Nat” table is the Nationalities list table with “Code” filed as PK
    - “Member” table is the Members data table with “Nationality” normal filed stors the "Code" value.

    Any idea please.
    <><><><><><><><><><><><><><><><><><>
    <><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
    <><><><><><><><><><><><><><><><><><>

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    It means that you have some entries in your child table that contain some values not included in your parent table. So you should check the related fileds to see if there is such an entry.

  3. #3

    Thread Starter
    Lively Member adsc's Avatar
    Join Date
    Nov 2002
    Location
    Kuwait
    Posts
    71
    Thank u Lunatic3,

    You are right, no errors now, but the relation is not working.
    Do you think the method I'm using is not correct?
    <><><><><><><><><><><><><><><><><><>
    <><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
    <><><><><><><><><><><><><><><><><><>

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I dont know how you are utilizing this relation that you claim it does not work. Considering the syntax, it seems correct.

  5. #5

    Thread Starter
    Lively Member adsc's Avatar
    Join Date
    Nov 2002
    Location
    Kuwait
    Posts
    71
    This is a brief of what I am donning in this part

    A window form displays all member basic information, this data stored to members database directly, one of these information is for member nationality.

    Nationalities stored in a separate table lists only nationality and have “Code” field as PK.

    In members form I’m displaying the nationality in ComboBox and I need the value to change according the nationality code stored in members table when the user clicks Next or Back buttons.

    I found to make a relation between these 2 tables will do the job, but!!!
    <><><><><><><><><><><><><><><><><><>
    <><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
    <><><><><><><><><><><><><><><><><><>

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Your parent table in the dataset should now contain an object called 'MemNat' (your relation name) and that containes the the filed of the child table. You should bind the desired control to this field.

    You may like to look at this article for more info about working with master/details tables.

  7. #7

    Thread Starter
    Lively Member adsc's Avatar
    Join Date
    Nov 2002
    Location
    Kuwait
    Posts
    71
    I already did all that, but no luck!!
    "Members" tabel moves fine but "Nat" table does not move points always to the first row.
    <><><><><><><><><><><><><><><><><><>
    <><> REMEMBER,,,,KNOWLEDGE IS POWER <><>
    <><><><><><><><><><><><><><><><><><>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width