MsiDatabaseOpenViewA function

The MsiDatabaseOpenView function prepares a database query and creates a view object. This function returns a handle that should be closed using MsiCloseHandle.

Syntax

UINT MsiDatabaseOpenViewA(
  MSIHANDLE hDatabase,
  LPCSTR    szQuery,
  MSIHANDLE *phView
);

Parameters

hDatabase

Handle to the database to which you want to open a view object. You can get the handle as described in Obtaining a Database Handle.

szQuery

Specifies a SQL query string for querying the database. For correct syntax, see SQL Syntax.

phView

Pointer to a handle for the returned view.

Return Value

The MsiDatabaseOpenView function returns one of the following values:

Remarks

The MsiDatabaseOpenView function opens a view object for a database. You must open a view object for a database before performing any execution or fetching.

If an error occurs, you can call MsiGetLastErrorRecord for more information.

Note that it is recommended to use variables of type PMSIHANDLE because the installer closes PMSIHANDLE objects as they go out of scope, whereas you must close MSIHANDLE objects by calling MsiCloseHandle. For more information see Use PMSIHANDLE instead of HANDLE section in the Windows Installer Best Practices.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.

Requirements

   
Minimum supported client Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP
Target Platform Windows
Header msiquery.h
Library Msi.lib
DLL Msi.dll

See Also

General Database Access Functions