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.
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?
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.
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.
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.