Conformance
Version Introduced: ODBC 2.0
Summary
SQLWritePrivateProfileString writes a value name and data to the Odbc.ini subkey of the system information.
Syntax
BOOL SQLWritePrivateProfileString( LPCSTR lpszSection, LPCSTR lpszEntry, LPCSTR lpszString, LPCSTR lpszFilename);
Arguments
Returns
The function returns TRUE if it is successful, FALSE if it fails.
Diagnostics
When SQLWritePrivateProfileString returns FALSE, an associated *pfErrorCode value can be obtained by calling SQLInstallerError. The following table lists the *pfErrorCode values that can be returned by SQLInstallerError and explains each one in the context of this function.
*pfErrorCode | Error | Description |
---|---|---|
ODBC_ERROR_GENERAL_ERR | General installer error | An error occurred for which there was no specific installer error. |
ODBC_ERROR_REQUEST_FAILED | Request failed | The requested system information could not be written. |
ODBC_ERROR_OUT_OF_MEM | Out of memory | The installer could not perform the function because of a lack of memory. |
Comments
SQLWritePrivateProfileString is provided as a simple way to port drivers and driver setup DLLs from Microsoft® Windows® to Microsoft Windows NT®/Windows 2000. Calls to WritePrivateProfileString that write a profile string to the Odbc.ini file should be replaced with calls to SQLWritePrivateProfileString. SQLWritePrivateProfileString calls functions in the Win32® API to add the specified value name and data to the Odbc.ini subkey of the system information.
A configuration mode indicates where the Odbc.ini entry listing DSN values is in the system information. If the DSN is a User DSN (the state variable is USERDSN_ONLY), the function writes to the Odbc.ini entry in HKEY_CURRENT_USER. If the DSN is a System DSN (SYSTEMDSN_ONLY), the function writes to the Odbc.ini entry in HKEY_LOCAL_MACHINE. If the state variable is BOTHDSN, HKEY_CURRENT_USER is tried, and if it fails, HKEY_LOCAL_MACHINE is used.
Related Functions
For information about | See |
---|---|
Getting a value from the system information | SQLGetPrivateProfileString |