ADO » Field » GetChunk

variable = fieldobject.GetChunk (Size)
The Size parameter is a long value that is the number of bytes or characters that you wish to retrieve from the database. If Size exceeds the actual size of the data you are retrieving, the data is returned without any added padding or empty space.

Returns a variant that contains the specified amount (size) of binary or text data.

The GetChunk method returns all or a portion of a binary or text data contained in a Field object. To use the GetChunk method, the adFldLong constant of the Attributes property of the specified Field object must be set to true.
This method and the companion AppendChunk method allow you to manipulate databases that contain, for example, large text files or images.
You can use this method to retrieve reasonable sized chunks of data from a Field object. The first GetChunk call will retrieve data starting at the beginning of the file. Each subsequent call proceeds from the point that the previous call ended. However, if you set or read the value of another Field, then go back to the first Field, and call GetChunk, this call will be treated as a first call and will retrieve data starting at the beginning of the file.
A null will be returned if the Field is empty. If there is no record, you will get an error.


Dim lngChunkSize
lngChunkSize = 100
varGotChunk = rsData(strFieldName).GetChunk(lngChunkSize)

See Also: