CodeSmith Community
Your Code. Your Way. Faster!

Many-to-Many Relationship using Web Library Controls revisited

Latest post 10-04-2006 5:09 PM by velum. 1 replies.
  • 10-04-2006 4:26 PM

    • velum
    • Top 25 Contributor
    • Joined on 07-14-2006
    • Montréal, Qc, Canada
    • Posts 186
    • Points 4,716

    Many-to-Many Relationship using Web Library Controls revisited

    Hi!

    In a previous post (12586), Bobby Diaz gave a good example of a Many-To-Many List Relationship. In that example, based on the relationship descirption (see below), I assume that the link table had the following format:

        CustomerCustomerDemo (CustomerID PK,  CustomerTypeID PK)

    but what if it had the following format:

        CustomerCustomerDemo (CustomerCustomerDemoID PK, CustomerID FK,  CustomerTypeID FK)

    Would this work with the ManyToManyListRelationship?

    How should the LinkeMember then be defined? 

    Note: A DBA I know recommanded that link tables have their own primary key, hence the three keys.

    Here is the  ManyToManyListRelationship used in Bobby's example:

                    <data:ManyToManyListRelationship ID="CustomerCustomerDemoRelationship" runat="server">
                        <%-- represents the Customers table --%>
                        <PrimaryMember runat="server"
                            DataSourceID="CustomersDataSource"
                            EntityKeyName="CustomerID"
                        />

                        <%-- represents the CustomerCustomerDemo link table --%>
                        <LinkMember runat="server"
                            DataSourceID="CustomerCustomerDemoDataSource"
                            EntityKeyName="CustomerID"
                            ForeignKeyName="CustomerTypeID"
                        />

                        <%-- represents the CustomerDemographics table --%>
                        <ReferenceMember runat="server"
                            DataSourceID="CustomerDemographicsDataSource"
                            ListControlID="CustomerDemographicsList"
                            EntityKeyName="CustomerTypeID"
                        />
                    </data:ManyToManyListRelationship>

     

    Cheers!

    JF
     

    • Post Points: 5
  • 10-04-2006 5:09 PM In reply to

    • velum
    • Top 25 Contributor
    • Joined on 07-14-2006
    • Montréal, Qc, Canada
    • Posts 186
    • Points 4,716

    Re: Many-to-Many Relationship using Web Library Controls revisited

    Reply |Contact |Answer

    Ok, I answered my own question. The LinkMember has to stay the same. I just tried it and it is working.

     

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems