finding the primary key

Results 1 to 2 of 2

Thread: finding the primary key

  1. #1
    Join Date
    Dec 1969

    Default finding the primary key

    can anyone suggest a way to find which column is the primary key of a table in an ms access db? i can't use the OpenSchema(adSchemaPrimaryKeys) because my db doesnt support it.

  2. #2
    Join Date
    Dec 1969

    Default RE: finding the primary key

    You could try getting it with ADOX<BR><BR>Set cat = Server.CreateObject("ADOX.Catalog")<BR>Set cat.ActiveConnection = Connection<BR><BR>For Each idx In cat.Tables(table_name).Indexes<BR> If idx.PrimaryKey Then<BR><BR>Other properties of the ADOX.Index<BR>idx.Clustered = True/False<BR>idx.Unique = True/False<BR><BR>idx.Columns(index).column_properties< BR>idx.Name<BR>idx.Properties<BR>idx.IndexNulls<BR ><BR>Are you using the JET OLEDB driver? Or the ODBC driver?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts