uuugh! I've been struggling with this one for a few days now, so after hitting all the relevant newg groups, let's see if anyone has a good answer:
Given a DataTable, I need to know all the Other DataTables that have a
Relation to this table. Specifically, I want to know all the relations in
which this table is a "Details" table (i.e. has a foreign key constraint).
I've tried using the DataAdapter.FillSchema method, but no luck.
I've also tried setting the DataAdapter.MissingSchemaAction to AddWithKey,
but still no luck.
I've made sure that the table actually has a foreign key in the DB(I'm using
Northwind SQL server).
The only way that works, is by using a completely different feature:
Connection.GetOleDBSchemaTable(), but It seems to me that this should be
possible using the DataAdapter as well. All the references I've read on the subject point to the fact that using each of these 2 methods od the DataAdapter will create those missing relations. :(
Just found out that FillSchema or Fill are not supposed to add Data Relations automatically. GetOleDBSchema is the only way. I'll try to create something generic for use in these situations , though.