Determining Foreign/Primary Keys in a Table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello, I'm looking for a generic way to determine Foreign/Primary keys
for a table in a Database I'm connected to via ODBC. The two examples
I've been working with so far are an Access Database and an Oracle
Database.

What I've tried so far:

I can determine Primary Keys (using the System.Data.ODBC controls
in .NET) but not foreign keys.

Also, I've been trying to use the API-calls SQLPrimaryKeys and
SQLForeignKeys from Visual C++ 6.

SQLForeignKeys doesn't crash, but doesn't return anything.
SQLPrimaryKeys works properly in Oracle; but Access gives me an error
number of -1 (Driver does not support this function). How could it not
support this? Any why won't ForeignKeys return anything at all (I have
specifically set and committed the foreign keys).


I can provide my source if thats helpful, and advice would be
appreciated! Thanks!

.