Retrieving Metadata - Foreign Keys

Retrieving Metadata - Foreign Keys

Postby nuntio » Sat 04 Feb 2006 17:30

Please help me to retrieve Foreign Keys.
This is my code to retrieve Primary Keys:

Code: Select all
private DataTable GetPrimaryKeys(string tablename)
{
  conn.Open();
            
  DataTable schemaTable = new DataTable();

  schemaTable.PrimaryKey = conn.GetSchema("Columns", new string[] { "Test", tablename }).PrimaryKey;

  conn.Close();
      
  return schemaTable;
}



I have to write the same method in order to retrieve the Foreign Keys.
Thanks,
Nunzio
nuntio
 

Constraints

Postby nuntio » Sat 04 Feb 2006 18:00

Please show me also how to retrieve Constraints.

Thx,
Nunzio
nuntio
 

Postby Serious » Mon 06 Feb 2006 08:29

To retrieve Foreign Keys metadata collection pass "ForeignKeys" string as parameter to GetSchema method call. This behavior is documented in "Retrieving Metadata" topic in MySQLDirect .NET documentation.

Please describe what constraints you want to retrieve in addition to foreign keys (ForeignKeys collection) and primary keys (PrimaryKeys collection)?
Serious
 

MySQLDirect.NET 2.8 doesn't support "ForeignKeys" in the GetSchema()

Postby nuntio2000 » Mon 06 Feb 2006 17:37

Hi,
I suppose that my copy of MySQLDirect.NET 2.8 doesn't support "ForeignKeys" in the GetSchema() parameters.

Thank you,
Nunzio
nuntio2000
 
Posts: 19
Joined: Fri 19 Nov 2004 18:51
Location: South Italy

Postby Serious » Tue 07 Feb 2006 07:28

You're right, this collection (and some others) was supported in MySQLDirect .NET 3.
Serious
 


Return to dotConnect for MySQL