ADO`s Stream Object - Opening a Stream with no argument, Memory Stream (Page 6 of 6 )
It is not even necessary to pass an URL to open a Stream. The Stream is now open in the memory and sitting in the memory. This can be very useful as it acts as if it caches the data which can both be persisted and read back. We will see this in a future tutorial. The next listing shows how the Stream is opened.
Private Sub Command0_Click()
Dim mstream As ADODB.stream
Set mstream = New ADODB.stream
'mstream.Type=adTypeBinary
mstream.Type = adTypeText
mstream.Open
If mstream.State = adStateOpen Then
Debug.Print ("Memory Stream is open: " & mstream.State)
Debug.Print ("Memory stream size is: " & mstream.Size)
End If
mstream.Close
Debug.Print ("Memory Stream is closed: " & mstream.State)
End Sub
The way you want to open a memory may be chosen by setting the Type property. The next listing shows the print out from the debug.print statement.
Memory Stream is open: 1
Memory stream size is: 0
Memory Stream is open: 0
Summary
This tutorial provides an introduction to the Stream object, one of the ADO objects which extends the reach of ADO to explore not only data, but other information resources. Microsoft Access 2003 on XP Professional Media Center Edition was used in testing the codes.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |