Windows Dev Center

MsiViewExecute function

The MsiViewExecute function executes a SQL view query and supplies any required parameters. The query uses the question mark token to represent parameters as described in SQL Syntax. The values of these parameters are passed in as the corresponding fields of a parameter record.

Syntax


UINT MsiViewExecute(
  _In_ MSIHANDLE hView,
  _In_ MSIHANDLE hRecord
);

Parameters

hView [in]

Handle to the view upon which to execute the query.

hRecord [in]

Handle to a record that supplies the parameters. This parameter contains values to replace the parameter tokens in the SQL query. It is optional, so hRecord can be zero. For a reference on syntax, see SQL Syntax.

Return value

ERROR_FUNCTION_FAILED

A view could not be executed.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_SUCCESS

The function succeeded.

Note that in low memory situations, this function can raise a STATUS_NO_MEMORY exception.

Remarks

The MsiViewExecute function must be called before any calls to MsiViewFetch.

If the SQL query specifies values with parameter markers (?), a record must be supplied that contains all of the replacement values in the exact order and of compatible data types. When used with INSERT and UPDATE queries all the parameterized values must precede all nonparameterized values.

For example, these queries are valid.

UPDATE {table-list} SET {column}= ? , {column}= {constant}

INSERT INTO {table} ({column-list}) VALUES (?, {constant-list})

However these queries are invalid.

UPDATE {table-list} SET {column}= {constant}, {column}=?

INSERT INTO {table} ({column-list}) VALUES ({constant-list}, ? )

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

See also

General Database Access Functions

 

 

Community Additions

ADD
Show:
© 2015 Microsoft