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;
}
Thanks,
Nunzio