Making a many-to-many relationship using DataRelations object
Posted
by dotnetdev
on Stack Overflow
See other posts from Stack Overflow
or by dotnetdev
Published on 2010-04-05T15:51:45Z
Indexed on
2010/04/05
15:53 UTC
Read the original article
Hit count: 175
c#
Hi,
I have about 200 tables which need to relate to another table in a many-to-many fashion. I have the tables (including the intersection table) ready IN SQL Server. How can I write code using the data relation object to make the relationship?
The tables are: PartStatPartName >> PartsMaterialsIntersection << Materials
The materials table needs to have a foreign key from the PartStatPartName table. I tried various approaches using the DataRelation class but the change did not sync to SQL Server, despite being connected and adding the relation, and then calling AcceptChanges() on the dataset.
Any guidance much appreciated. I have seen some threads covering the same problem but need an example in code so I can follow the right method.
Thanks
© Stack Overflow or respective owner