SPS Home    >   Dgreath    >   VbScript    >   ADO


ActiveX Data Objects (ADO)

ADO.Stream  This class provides a set of properties and methods necessary to read, write, and manage binary or text stream objects.
.Cancel
(WO) Cancels an attempt to open a stream.
.CharSet(CdoCharset As String)
[CdoCharset As String] (RW) Sets or returns a value that specifies into which character set the contents are to be translated. Only used with text stream objects (adTypeText) and  is ignored otherwise. The default value is Unicode if not specified. It is read only except when position = 0.  
.Close
(WO) Closes the stream object and any dependant objects as well. It releases resources bound to the object but does not remove it from memory. Closed streams can be reopened with the same or modified attributes.
.CopyTo(DestinationStream [, numchars])
(WO) Copies either all (default) or a specified number of characters/bytes (optional) from one stream object to another. The default value is -1. Note that binary streams cannot be copied into text streams but all other copies are valid.
.EOS
[Boolean] (RO) Returns whether the current position is at the end of the stream (true) or not (false).
.Flush
(WO) Send the contents of the stream buffer to the associated underlying object. It has no effect if there is not an associated underlying source and the action occurs automatically as part of the .Close process.
.LineSeparator(LineSeparator As LineSeparatorEnum)
[LineSeparatorsEnum] (RW) Sets or returns the line separator character used in a text stream object and is ignored for binary streams. The default value is adCrLf
.LoadFromFile(filename As String)
(WO) Loads the contents of a file into a stream object. Filename can be any valid UNC name and can be used to copy a local file to a server. The stream object must be already open and upon load, sets position to 0. Note that two additional bytes may be added to the beginning of the file during the encoding process.
.Mode(mode As ConnectModeEnum)
[ConnectModeEnum] (RW) Sets or returns the available permissions for modifying the data. The default value for a stream associated with an underlying source is adModeRead, however for streams where there is no underlying source the default value is adModeUnknown. The property is read/write when the object is closed and read only when the object is open.
.Open([url][, mode As ConnectModeEnum][, options As StreamOpenOptionsEnum][, username As String][, password As String])
[] (WO) Opens the stream object for reading or writing. If a source is specified, it becomes the underlying source. If no source is specified, it is treated as having no associated underlying source.
.Position(position As Long)
[position As Long] (RW) Sets or returns the current pointer position in bytes from the beginning of the stream object. The default value is 0. Position cannot be a negative number.
.Read([numBytes As Long])
[numBytes As Long] (RO) Reads the entire stream (default) or a specified number of bytes (optional) from a binary stream object.
.ReadText ([numChars As Long])
[numChars As Long] (RO) Reads the entire stream (default) or a specified number of characters (optional) from a text stream object.
.SaveToFile(filename As String, options As SaveOptionEnum)
(WO) Saves the binary contents of a stream object to a file. After execution, the current pointer is set to 0. The default value of options is adSaveCreateNotExists.
.SetEOS
(WO) Sets the current pointer position to be the end of the stream. Any data beyond this point is truncated.
.Size
[size As Long] (RO) Returns the size of an open stream object in bytes. Size can only be used with open stream objects. The default value is the size of the stream or -1 if unknown.
.SkipLine
(WO) Skips a line when reading a text stream. The default value is adCrLf.
.Stat(statStg, statFlag)
[status As Long] (RO) Returns information about the status of the stream object.
.State
[state As ObjectStateEnum] (RO) Returns a value describing if the stream object is open or closed. The default value is adStateClosed. The value can have a combination of values.
.Type(type As StreamTypeEnum)
[StreamTypeEnum] (RW) Sets or returns a value that specifies the type of data in a stream object. The default value is adTypeText. It is read only except when position = 0. Note that if binary data is written to a new empty stream object, the default will switch to adTypeBinary. When set to adTypeText, use .ReadText and WriteText methods; when set to adTypeBinary use .Read and .Write methods..  
.Write(buffer As byteArray)
(WO) Writes binary data to a binary stream object and adusts the pointer accordingly.
.WriteText(data As String [,options As StreamWriteEnum] )
(WO) Writes character data to a text stream object and adjusts the pointer accordingly. 
ADO.Field  This class provides a set of properties and methods necessary to create, read to, and write from Field items in a ADO collection.
.ActualSize
[Long] (RO) Returns the actual length of a field's value.
.AppendChunk data
(WO) Appends a long binary or character date to a field object. 'data' represents the data to append.
.Attributes
[Long] (RW) Sets or returns the attributes of a field object.  Sum of XactAttributeEnum, ParameterAttributesEnum, FieldAttributeEnum, and PropertyAttributesEnum values.
.DefinedSize
[Long] (RO) Returns the defined size of a field.
.GetChunk(size As Long)
[Varient] (RO) Returns all or a part of the contents of a large text or binary data field object.
.Name
[String] (RW) Sets or returns the name of a field object.
.NumericScale
[Byte] (RW) Sets or returns the number of decimal places to the right allowed for numeric values in a field object.
.OriginalValue
[Varient] (RO) Returns the original value of a field.
.Precision
[Byte] (RW) Sets or returns the maximum number of digits allowed when representing numeric values in a field object.
.Properties
(RW) A collection consisting of all the property objects for a field object.
.Status
[FieldStatusEnum] (RO) Returns the status of a field object.
.Type
[DataTypeEnum] (RW) Sets or returns the type of a field object..
.UnderlyingValue
[Varient] (RO) Sets or returns thecurrent value of a field object.
.Value
[Varient] (RW) Sets or returns the value of a field object.
ADO Constants and Enumerations. A fairly complete list of ADO Constants and Enumerations is available to read or download here: ADOVBS.INC. This file can be included in ASP applications or portions copied into VBscripts as needed.