I am using C# with MS Access 2010. I need to retrieve the table relationships from the DB in order to determine the relationships between entities and use them in my C# code.
I need the same functionality for SQL Server database also.
Is there a way to do this using C# and .NET 3.0/ 3.5/ 4.0?
Appreciate your time.
Thanks,
Mahesh
This is the code I used to retrieve the foreign key constraints (the relationships, if you prefer).
TableSchema,ForeignKeyandForeignKeyColumnare my own classes, where I store the result. The point is to use theGetOleDbSchemaTablemethod of theOleDbConnection: