Making a many-to-many relationship using DataRelations object
- by dotnetdev
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