Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

GetOleDbSchema versus GetSchema and how to get key column names

626597Mar 5 2008 — edited Mar 6 2008
Hi

I have the following problem. When I was using previously the microsoft System.Data.OleDb library and had a method call GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys)
I could retrieve the foreign column names and a corresponding primary column name in one loop.

DataTable foreignKeysTables =
connection.GetOleDbSchema(OleDbSchemaGuid.Foreign_Keys, ...);
foreach (DataRow dr in foreignKeysTables.Rows)
{
string foreignKeyColumnName = dr["FK_COLUMN_NAME"].ToString();
string primaryKeyColumnName = dr["PK_COLUMN_NAME"].ToString();
}

If I use the ODP.NET library, and use
DataTable foreignKeysTables =
connection.GetSchema("ForeignKeys", ...);
Those columns are removed. Why are they removed if that is what the method is asking for.
You can get only FOREIGN_KEY_TABLE_NAME and similar tables, but NO columns.
Is there a reason for that, and how can I retrieve columns, that previously in an old version of a method, existed?

The same stands for Primary_Keys, where previously, I could retrieve primary key column name with a call to:
DataTable primaryKeysTables =
connection.GetOleDbSchema(OleDbSchemaGuid.Primary_Keys, ...);
foreach (DataRow dr in foreignKeysTables.Rows)
{
string primaryKeyColumnName = dr["COLUMN_NAME"].ToString();
}

But now the COLUMN_NAME is gone and I can only get primary key TABLE_NAME, but no column name.
Why are the columns removed and what is the alternative?

Regards,
Sebastijan P.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 3 2008
Added on Mar 5 2008
1 comment
2,112 views