PDA

View Full Version : سوال: ارتباط بین فیلدهای دو Table در Dataset



behiunforgiven
شنبه 23 آبان 1388, 11:44 صبح
سلام دوستان

من توی یک Dataset دو تا Table دارم و می خوام بین دو تا از فیلد های این ها ارتباطی برقرار کنم. به این نحو که یک فیلد مقدار خودش رو از فیلد دوم بگیره.

در ضمن این دو تا فیلد توی خود Table اصلی نیست (database اصلی) و من خودم به صورت دستی توی Dataset ایجادشون کردم.


اگه میشه لطفا راهنمایی کنید.

A.S.Roma
یک شنبه 24 آبان 1388, 12:04 عصر
ببینید همچین چیزی به درد تون می خوره !؟
مثلا" البته این مثال رابطه 1 به چند بین دو ستون از یک جدول را برقرار می کند:
ds.DataSetName = "Menus";
ds.Tables[0].TableName = "Menu";
DataRelation relation = newDataRelation("ParentChild",
ds.Tables["Menu"].Columns["MenuID"],
ds.Tables["Menu"].Columns["ParentID"], true);

relation.Nested = true;
ds.Relations.Add(relation);

hjolany
چهارشنبه 10 شهریور 1389, 20:24 عصر
Nested Relations

1NF requires that all attributes have atomic (indivisible) domains.
The nested relational model is an extension of the relational model in which domains may be either atomic or relation-valued. This allows a complex object to be represented by a single tuple of a nested relation -- one-to-one correspondence between data items and objects.
Suppose the information to be stored consists of (i) document title, (ii) author_list (set of authors), (iii) date (day, month, year), and (iv) key_word_list (list of key words).
Example: A non-1NF document relation, doc.


The doc relation can be represented in 1NF, doc', but awkward. If we assume the following multi-value dependencies (MVDs) hold:

title author

title keyword


title day month year



we can decompose the relation into 4NF using the schemes:

(title, author)

(title, keyword)


(title, day, month, year)



But the non-1NF representation may be an easier-to-understand model (closer to user's view). The 4NF design would require users to include joins in their queries, thereby complicating interaction with the system. We could define a view, but we lose the one-to-one correspondence between tuples and documents.