D
David Thielen
Hi;
We have a .NET app where we have to use the ADO.NET ODBC connector
OdbcConnection to get metadata from a database.
We can get column information using:
using (OdbcConnection conn = new OdbcConnection(connStr))
{
conn.Open();
string[] restrictions = new string [] { null, null,
table.FullName };
DataTable schemaTable = conn.GetSchema("columns",
restrictions);
....
And this gives us each column's name, data type, and remarks. That all
works great and appears to supported by most ODBC drivers.
However, we also need to get the foreign key -> primary key
relationships. So for example the column OrderItem.OrderId we need to
know it is a FK pointing to Order.OrderId.
How can we do this? Preferably in a manner that works for all ODBC
drivers. But if not, then vendor specific code (I assume a select) for
Access, Firebird, and Progress.
thanks - dave
david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm
We have a .NET app where we have to use the ADO.NET ODBC connector
OdbcConnection to get metadata from a database.
We can get column information using:
using (OdbcConnection conn = new OdbcConnection(connStr))
{
conn.Open();
string[] restrictions = new string [] { null, null,
table.FullName };
DataTable schemaTable = conn.GetSchema("columns",
restrictions);
....
And this gives us each column's name, data type, and remarks. That all
works great and appears to supported by most ODBC drivers.
However, we also need to get the foreign key -> primary key
relationships. So for example the column OrderItem.OrderId we need to
know it is a FK pointing to Order.OrderId.
How can we do this? Preferably in a manner that works for all ODBC
drivers. But if not, then vendor specific code (I assume a select) for
Access, Firebird, and Progress.
thanks - dave
david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com
Cubicle Wars - http://www.windwardreports.com/film.htm