Database
  Home arrow Database arrow Page 3 - Opening a Record Object Referencing an Ope...
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
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

Opening a Record Object Referencing an Open Recordset Object
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2006-09-12

    Table of Contents:
  • Opening a Record Object Referencing an Open Recordset Object
  • Opening a Recordset by Providing an URL
  • Opening the Record Object after Opening the Recordset Object
  • RecordType and Mode Properties

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Opening a Record Object Referencing an Open Recordset Object - Opening the Record Object after Opening the Recordset Object
    (Page 3 of 4 )

    The record object has a number of properties and methods as shown in this extract from the Object Browser. These may be interrogated once the record is open.

    The Record.Open () method has the following syntax as shown in the next picture. Not only it is possible to display the records, but you can also create files and folders.

    Use the following code in another form’s button click event, or another button on the same form.

    Private Sub Command0_Click()
    ‘Declare a recordset object
    Dim rst As ADODB.Recordset
    ‘Declare a record object
    Dim rec As ADODB.Record
    ‘instantiate the recordset
    Set rst = New ADODB.Recordset
    ‘open the recordset
    rst.Open "", "URL=http://hodentek/Atlas Website"
    ‘instantiate the record [Recordset is Open]
    Set rec = New ADODB.Record
    ‘open the record
    rec.Open rst
    ‘--------Interrogate Properties-----
    Text1.SetFocus
    Text1.Text = rec.ActiveConnection
    Text5.SetFocus
    Text5.Text = rec.Mode
    Text7.SetFocus
    Text7.Text = rec.ParentURL
    Text9.SetFocus
    Text9.Text = rec.RecordType
    ‘---end interrogation--
    Set rst = Nothing
    End Sub 

    The Mode and RecordType are returned as Enumerated constants, a basic feature of ADO. Mode: 1 refers to the constant adModeRead, the default, read only for the record open. The RecordType: 0 refers to the constant adSimpleRecord which means there are no child records. The ParentURL property is also read only. How many fields are there in this record and what are they?

    To answer these questions you need to know how many fields there are in the record. This is easily done by including a calling of the the rec.Count property. Once you know this, you find the items collection in which each item is indexed and has a name and value by inserting the following code snippet before you close the record (between Text9.text and Set rst=nothing).

    MsgBox (rec.Fields.Count)
    For i = 0 To rec.Fields.Count – 1 
    Debug.Print rec.Fields (i).Name & " : " & rec.Fields (i).Value & vbCrLf
    Next i
    The Debug.Print statement copied from the immediate window is as follows:
    RESOURCE_PARSENAME : Default.aspx
    RESOURCE_PARENTNAME : http://hodentek/AtlasWebSite
    RESOURCE_ABSOLUTEPARSENAME : http://hodentek/AtlasWebSite/Default.aspx
    RESOURCE_ISHIDDEN :
    RESOURCE_ISREADONLY :
    RESOURCE_CONTENTTYPE :
    RESOURCE_CONTENTCLASS :
    RESOURCE_CONTENTLANGUAGE :
    RESOURCE_CREATIONTIME :
    RESOURCE_LASTACCESSTIME :
    RESOURCE_LASTWRITETIME : 3/21/2006 4:06:42 PM
    RESOURCE_STREAMSIZE : 924p
    RESOURCE_ISCOLLECTION : False
    RESOURCE_ISSTRUCTUREDDOCUMENT :
    DEFAULT_DOCUMENT : http://hodentek/Default.htm;http://hodentek/
    Default.asp;http://hodentek/index.htm;http://hodentek/iisstart.asp
    RESOURCE_DISPLAYNAME : Default.aspx
    RESOURCE_ISROOT : False
    RESOURCE_ISMARKEDFOROFFLINE :
    RESOURCE_METATAGS :
    RESOURCE_LISTBASETYPE :
    DAV:name : Default.aspx
    DAV:parentname : http://hodentek/AtlasWebSite
    DAV:displayname :
    Default.aspx
    DAV:isroot : False
    DAV:getlastmodified : 3/21/2006 4:06:42 PM
    DAV:getcontentlength : 924
    DAV:iscollection : False
    DAV:defaultdocument : http://hodentek/Default.htm;http://hodentek/ Default.asp;http://hodentek/index.htm;http://hodentek/iisstart.asp

    These are standard fields returned by the OLE DB provider, in this case the Internet Publishing (MSDAIPP) provider. This list also contains the item RESOURCE_STREAMSIZE: 924, the size of the resource which may be retrieved using the Stream object.

    More Database Articles
    More By Jayaram Krishnaswamy


       · Microsoft's first foray into accessing non-traditional data storage area resulted in...
     

    DATABASE ARTICLES

    - Database Programming in C# with MySQL : Usin...
    - Formatting Techniques for Data Access from E...
    - Data Access from Excel VBA
    - Generating a Multiple Table Crystal Report u...
    - ADO and the Command Object
    - On Wiring Up an ADO Data Control
    - Reading and Writing to Files on the Intranet
    - Using ADO Record to Create and Navigate Intr...
    - Using Data Access Pages to Access Data on a ...
    - Using ADO with the SQL Native Client
    - ADO`s Stream Object
    - Opening a Record Object Referencing an Open ...
    - Introducing Jasper (SQL Anywhere 10 Beta)
    - Creating a Database Project in VS 2005
    - Manipulating ADO Recordsets




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway