Open Method (ADO Stream)

Microsoft ActiveX Data Objects (ADO)

Open Method (ADO Stream)

       

Opens a Stream object to manipulate streams of binary or text data.

Syntax

Stream.Open Source, Mode, OpenOptions, UserName, Password

Parameters

Source   Optional. A Variant value that specifies the source of data for the Stream. Source may contain an absolute URL string that points to an existing node in a well-known tree structure, like an e-mail or file system. A URL should be specified using the URL keyword ("URL=http://server/folder"). Alternately, Source may contain a reference to an already open Record object, which opens the default stream associated with the Record. If Source is not specified, a Stream is instantiated and opened, associated with no underlying source by default.

Mode   Optional. A ConnectModeEnum value that specifies the access mode for the resultant Stream (for example, read/write or read-only). Default value is adModeUnknown. See the Mode property for more information about access modes. If Mode is not specified, it is inherited by the source object. For example, if the source Record is opened in read-only mode, the Stream will also be opened in read-only mode by default.

OpenOptions   Optional. A StreamOpenOptionsEnum value. Default value is adOpenStreamUnspecified.

UserName   Optional. A String value that contains the user identification that, if needed, accesses the Stream object.

Password   Optional. A String value that contains the password that, if needed, accesses the Stream object.

Remarks

When a Record object is passed in as the source parameter, the UserID and Password parameters are not used because access to the Record object is already available. Similarly, the Mode of the Record object is transferred to the Stream object.

When Source is not specified, the Stream opened contains no data and has a Size of zero (0). To avoid losing any data that is written to this Stream when the Stream is closed, save the Stream with the CopyTo or SaveToFile methods, or save it to another memory location.

While the Stream is not open, it is possible to read all the read-only properties of the Stream. If a Stream is opened asynchronously, all subsequent operations (other than checking the State and other read-only properties) are blocked until the Open operation is completed.