MsiDatabaseGetPrimaryKeys

[This is preliminary documentation and subject to change.]

The MsiDatabaseGetPrimaryKeys function returns a record containing the names of all the primary key columns.

UINT MsiDatabaseGetPrimaryKeys(
  MSIHANDLE hDatabase,   // database handle
  LPCTSTR szTableName,   // name of table
  MSIHANDLE *phRecord    // handle for record
);
 

Parameters

hDatabase
Handle to the database.
szTableName
Specifies the name of the table from which to obtain primary key names.
phRecord
Pointer to the handle of the record that holds the primary key names.

Return Values

ERROR_INVALID_HANDLE
An invalid or inactive handle was supplied.
ERROR_INVALID_PARAMETER
An invalid parameter was passed to the function.
ERROR_INVALID_TABLE
An invalid table was passed to the function.
ERROR_SUCCESS
The function succeeded.

Remarks

The field count of the returned record is the count of primary key columns returned by the MsiDatabaseGetPrimaryKeys function. The returned record contains the table name in Field (0) and the column names that make up the primary key names in succeeding fields. These primary key names correspond to the column numbers for the fields.

This function cannot be used with the _Tables table or the _Columns table.

QuickInfo

  Windows NT: Requires version 4.0 or later. Available as a redistributable for Windows NT 4.0.
  Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Header: Declared in msiquery.h.
  Import Library: Use msi.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Database Access Reference, General Database Access Functions