Export (0) Print
Expand All
Expand Minimize

MsiDatabaseOpenView 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 MsiDatabaseOpenView(
  _In_   MSIHANDLE hDatabase,
  _In_   LPCTSTR szQuery,
  _Out_  MSIHANDLE *phView
);

Parameters

hDatabase [in]

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 [in]

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

phView [out]

Pointer to a handle for the returned view.

Return value

The MsiDatabaseOpenView function returns one of the following values:

ERROR_BAD_QUERY_SYNTAX

An invalid SQL query string was passed to the function.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_SUCCESS

The function succeeded, and the handle is to a view object.

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

Version

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

Header

Msiquery.h

Library

Msi.lib

DLL

Msi.dll

Unicode and ANSI names

MsiDatabaseOpenViewW (Unicode) and MsiDatabaseOpenViewA (ANSI)

See also

General Database Access Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft