Database
  Home arrow Database arrow Page 4 - ADO`s Stream Object
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE

ADO`s Stream Object
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2006-09-19

    Table of Contents:
  • ADO`s Stream Object
  • How to open a Stream object using ADO
  • Syntax for opening a Stream
  • Opening a Stream using an open Record Object
  • Opening a Stream using an URL reference
  • Opening a Stream with no argument, Memory Stream

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ADO`s Stream Object - Opening a Stream using an open Record Object


    (Page 4 of 6 )

    It is not necessary to open a recordset followed by a record to open the Stream. If you have a record already open you may just open the Stream object using that record. The record contains the Stream whose properties can be found. The following code shows how the default properties are found.

     
    Private Sub Command0_Click()
     
    Dim rec As New ADODB.Record
    rec.Open "testing.txt", "URL=http://hodentek/"
    Debug.Print "rec.Fields(2).Value: " & (rec.Fields(2).Value) & vbCrLf
    Debug.Print "rec.State: "; (rec.State) & vbCrLf
    '-------
    Dim strm As New ADODB.stream'Item() may show index, but use this code
    Set strm = rec.Fields.Item(ADODB.FieldEnum.adDefaultStream).Value
     
    If strm.State = adStateOpen Then
    Debug.Print "-------------------------" & vbCrLf
    Debug.Print "Stream Open" & vbCrLf
    Debug.Print "-------------------------" & vbCrLf
    Debug.Print "strm.State: " & strm.State & vbCrLf
    Debug.Print "strm.Type: " & strm.Type & vbCrLf
    Debug.Print "strm.Size: " & strm.Size & vbCrLf
    End If
    strm.Close
    Debug.Print "Stream Closed"
    Debug.Print "-------------------------" & vbCrLf
     
    Set strm = Nothing
    '--------
    rec.Close
    'MsgBox (rec.State)
    End Sub

    The debug.print statements will give the print out of some of the values that are sought as shown in the next paragraph.

    ------------------------------------
    rec.Fields(2).Value: http://hodentek/testing.txt
    rec.State: 1
    -------------------------
    Stream Open
    -------------------------
    strm.State: 1
    strm.Type: 2
    strm.Size: 5271 [This is a different resource examined]
    Stream Closed
    -------------------------

    More Database Articles
    More By Jayaram Krishnaswamy


       · There will be a follow up article that shows you how to manipulate the web files on...
     

    DATABASE ARTICLES

    - Manage Projects with SQL Server Management S...
    - Query Editing and Regular Expressions with S...
    - Using SQL Server Management Studio Tools
    - SQL Server Management Studio
    - Exporting a MySQL Database to Excel Using OD...
    - Controlling Databases with SQL Server 2005 D...
    - Using Recovery Models with SQL Server 2005 D...
    - Handling Database Properties for the SQL Ser...
    - Managing Permissions with the SQL Server 200...
    - SQL Server 2005 Database Engine Security
    - Administering SQL Server 2005 Database Engine
    - Building Applications with Anonymous Types
    - A Closer Look at Anonymous Types
    - Programming with Anonymous Types
    - Converting Your Excel Worksheet into a Worki...





    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek