Freigeben über


IDataInitialize::WriteStringToStorage

Writes a connection string.

Syntax

HRESULT WriteStringToStorage(
   LPCOLESTR      pwszFileName,
   LPCOLESTR      pwszInitializationString,
   DWORD          dwCreationDisposition);

Parameters

  • pwszFileName [in]
    Name of the file.

  • pwszInitializationString [in]
    Connection string to write.

  • dwCreationDisposition [in]
    Flags controlling the write operation. Same as Win32? CreateFiledwCreationDisposition (CREATE_NEW, CREATE_ALWAYS, OPEN_EXISTING, OPEN_ALWAYS, TRUNCATE_EXISTING).

Return Code

  • S_OK
    The method succeeded.

  • E_FAIL
    A provider-specific error occurred.

  • E_INVALIDARG
    pwszFileName was a null pointer.

    pwszInitializationString was a null pointer.

    dwCreationDisposition was an invalid value.

  • STG_E_FILENOTFOUND
    dwCreationDisposition was OPEN_EXISTING, and the file indicated by pwszFileName was not found.

    dwCreationDisposition was TRUNCATE_EXISTING, and the file indicated by pwszFileName was not found.

  • STG_E_FILEALREADYEXISTS
    dwCreationDisposition was CREATE_NEW, and the file indicated by pwszFileName already exists.

  • STG_E_PATHNOTFOUND
    The specified path name does not exist.

  • STG_E_ACCESSDENIED
    dwCreationDisposition was OPEN_EXISTING or TRUNCATE_EXISTING, and the caller has insufficient permission to open the file.

    dwCreationDisposition was OPEN_EXISTING or TRUNCATE_EXISTING, and another caller has the file open.

    dwCreationDisposition was CREATE_NEW, and the caller has insufficient permission to write to the directory.

  • STG_E_INVALIDNAME
    pwszFileName was an invalid file name.

Comments

The writing of the file will respect any file system flags on an existing file. For example, if the file is marked as read-only, the IDataInitialize::WriteStringToStorage method will fail and not overwrite the existing file.