IDataInitialize::LoadStringFromStorage

OLE DB Programmer's Reference

Loads a connection string.

HRESULT LoadStringFromStorage(    LPCOLESTR     pwszFileName,    LPCOLESTR *   ppwszInitializationString);

Parameters

pwszFileName [in]
Name of the file.
ppwszInitializationString [out]
On exit, *ppwszInitializationString will contain the connection string.

Return Code

S_OK
The method succeeded.
E_FAIL
A provider-specific error occurred.
E_INVALIDARG
pwszFileName was a null pointer.

ppwszInitializationString was a null pointer.

STG_E_FILENOTFOUND
The file indicated by pwszFileName was not found.
STG_E_ACCESSDENIED
The caller has insufficient permission to open the file.

The file is already open and locked for writing.

STG_E_INVALIDNAME
pwszFileName was an invalid file name.
STG_E_INVALIDHEADER
pwszFileName was a file that is not a UDL format file.

Comments

The ppwszInitializationString retrieved using this method will have any leading or trailing spaces trimmed from it. Hence, the string might not be exactly the same one as written using the IDataInitialize::WriteStringToStorage method. For example, passing in the string

   "   Provider=MSDASQL.1; User ID = sa   "

will be returned as

   "Provider=MSDASQL.1; User ID = sa"

When using .udl files to establish a connection, add "Udl Pooling" to the registry under the "SOFTWARE\Microsoft\DataAccess" key to improve performance. A Cache Size value greater than 0 (Cache Size=1) will enable the feature. A value of 100 is recommended.

1998-2001 Microsoft Corporation. All rights reserved.



Microsoft Ole Db 2.0 Programmer's Reference and Data Access SDK
Microsoft OLE DB 2.0 Programmers Reference and Data Access SDK (Microsoft Professional Editions)
ISBN: 0735605904
EAN: 2147483647
Year: 1998
Pages: 1083

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net