CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Location
    St.Louis MO, USA
    Posts
    672

    Two Parent and one child DataRelation , Is it possible?

    I have 3 tables [ tblItems , tblUser , tblUsage]

    tblItem [ ItemId , Item Name , Description ]
    tblUser [ UserId , UserFirstName , UserLastName ,........]
    tblUsage[ ItemId , UserId , BeginDate , EndDate , ..........]

    I need to create a relation of such tblUsage as child of two parents ( tblItem and tblUser ) but when i create its relation then it gives me error like "Cannot create a Key from Columns that belong to different tables."

    Is it possible or not. . Any suggestions would be appreciated.

    Thanks in Advance.
    A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.

    NAUMAAN

  2. #2
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: Two Parent and one child DataRelation , Is it possible?

    The message seems to imply that the key for tblUsage is a combination of ItemId and UserId. Have you considered just having a uniqueId field for the key in tblUsage?

  3. #3
    Join Date
    Dec 2002
    Location
    St.Louis MO, USA
    Posts
    672

    Re: Two Parent and one child DataRelation , Is it possible?

    Yes i have considered this, I did not want any UserId-ItemId pair duplicaton with unique Id combination.
    A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.

    NAUMAAN

  4. #4
    Join Date
    Nov 2006
    Location
    North Bend, WA
    Posts
    487

    Re: Two Parent and one child DataRelation , Is it possible?

    I realize that, but you can still enforce that without having to make it the primary key. Most of the SQL pros I know pretty much always make their primary key a unique Id and then use contraints to enforce data uniqueness.

  5. #5
    Join Date
    Dec 2002
    Location
    St.Louis MO, USA
    Posts
    672

    Re: Two Parent and one child DataRelation , Is it possible?

    Thanks for your help , but i m quite ok with database design here. I have this issue at FrontEnd not on BackEnd. I m talking about DotNet System.Data.DataRelation.
    A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.

    NAUMAAN

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

Featured