C # / Access Getting primary keys from Access 2003
source link: https://www.codesd.com/item/c-access-getting-primary-keys-from-access-2003.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
C # / Access Getting primary keys from Access 2003
I'm using OleDb to interact with an Access database, and I'm trying to find out how to get the primary keys of each table, but in such a way that they are associated with the tables. In other words, I don't just want a flat list of the primary key column names--I want to be able to determine which table they belong to.
Any idea how to do this? I've used the GetSchema()
method to get a table of tables, but that table's information does not appear to include primary keys (or any other indexes, for that matter).
Ok--did a little outputting of column names and got a better understanding of how the schema tables are related.
To do this, pass the string "Indexes" to the GetSchema()
method. Each record in the index table contains both the table name and whether or not the index is the primary key.
Related Articles
How to get PRIMARY KEY from the database using the value of another column? (Android, SQLite)
Extract the primary key from an entity object in JPA 2.0?
Primary key composed of primary keys from other tables
pyodbc - Read primary keys from MS Access database (MDB)
How to get a single primary key from a range, select in simultaneous table reads
jqGrid - How to add a row to a subgrid? or how to get the primary key from the parent line?
Getting the Autonumber Primary Key from MS SQL Server
Inserting many lines in EF too slow, how to get the primary key from SqlBulkCopy?
get a primary key from the table
Changing primary keys from multiple rows at a time
Change the Auto-Increment field, Primary Key from SMALLINT to INT in SQL Server
Generic Entity Framework method to retrieve the primary key from combobox
Designing the Database: Primary Key from Multiple Data Sources
Copy a primary key from a target table as a foreign key to the source table on an insert
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK