EDIT
Please view the following image, it details the PICTURES which show that only ADO.NET ENTITY FRAME WORK DOESNOT recognize one to many association but the DATASET DOES.
http://imgur.com/a4WzM.gif
(sorry but i do not have enough reputation to upload the image directly)
I have two tables
table1: Name [NAMEID, NAME] (NAMEID is the PK)
table2: Description [DESCID,DESCRIPTION,IDofNAME](DESCID is the PK, and IDofNAME is the FK related to NAMEID)
one name can have many descriptions, which themselves are independent of the name.
The dataentry from SQL SERVER works, and the relationship is also preserved.
but, PROBLEM
In vs10 Data Sources the "Name" table has a child "Description" which again has a child "Name" which again has a child "Description" and this continues with no end.
The same is for the "description" table relation with "name" table which has child/relation with "description" table, which again has relation with "name" table and this thing has no end.
On grid Problem
The datagrid which is made on design time by drag-drop of the NAME table开发者_如何学运维, displays fields [nameid, name, NAME OF THE RELATED TABLE (not the fields the whole NAME!)
PLEASE HELP ME OUT HERE, what am i doing wrong in making the relation of pk-fk
thanku
Sounds like your tables might be in a many to many relationship. One name can have many descriptions, each can describe zero or more names. If this is the case you should add a resolver table between them eg
CREATE TABLE NameDescription
([nameid] [int] NOT NULL,
[descriptionid] [int] NOT NULL )
With this approach you will no longer need the foreign key in the Description table and instead you will join through this new table.
精彩评论