MsiRecordSetStringA function (msiquery.h)

The MsiRecordSetString function copies a string into the designated field.


UINT MsiRecordSetStringA(
  [in] MSIHANDLE hRecord,
  [in] UINT      iField,
  [in] LPCSTR    szValue


[in] hRecord

Handle to the record.

[in] iField

Specifies the field of the record to set.

[in] szValue

Specifies the string value of the field.

Return value

This function returns UINT.


In the MsiRecordSetString function, a null string pointer and an empty string both set the field to null. Attempting to store a value in a nonexistent field causes an error.

To set a record string field to null, set szValue to either a null string or an empty string.


The msiquery.h header defines MsiRecordSetString as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.


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

Record Processing Functions