ADO 2'5 New Features - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

ADO 2'5 New Features

Description:

ADO 2.5 New Features. Dave Sussman, Wrox Press. Topics to be covered. Versions, Versions, Versions ... 172-32-1176 White Bob 408 496-7223 10932 Bigge Rd. ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 28
Provided by: davidsu150
Category:
Tags: ado | features | new | sussman

less

Transcript and Presenter's Notes

Title: ADO 2'5 New Features


1
ADO 2.5 New Features
  • Dave Sussman, Wrox Press

2
Topics to be covered
  • Versions, Versions, Versions
  • Semi-Structured Storage
  • The Record Object
  • The Stream Obejct
  • Using URLs
  • Document Source Providers

3
Oh no, not another version
  • NOT a major release
  • New objects
  • Record
  • Stream
  • New usage - URLs
  • Minor changes to existing objects
  • Existing code won't break
  • Possible exception Non-standard error handling

4
Universal Data Access
  • Semi-Structured Data
  • Not binary, but not fully structured
  • Tree like
  • Nodes
  • Sub-Nodes
  • Leaf elements
  • Variable number of columns

5
Structured Data
  • Each row contains the same structure as the
    previous row
  • SQL data

au_id au_lname au_fname phone address 172-32-117
6 White Bob 408 496-7223 10932 Bigge Rd.
213-46-8915 Green Marjorie 415 986-7020 309 63rd
St. 411 238-95-7766 Carson Cheryl 415
548-7723 589 Darwin Ln. 267-41-2394 O'Leary Michae
l 408 286-2428 22 Cleveland Av.
14 274-80-9391 Straight Dean 415 834-2919 5420
College Av. 341-22-1782 Smith Meander 913
843-0462 10 Mississippi Dr.
6
Semi-Structured Data
  • File Systems

Mail Systems
7
Semi-Structured Data
  • Web Servers

XML Stream
ltcontactgt ltfnamegtJaninelt/fnamegt
ltsnamegtPatonlt/snamegt ltphonegt00 33 149 12
1234lt/phonegt lt/contactgt lteventsgt lteventgt
lttypegtsailinglt/typegt ltlocationgtChicagolt/locati
ongt ltwithgtAdamlt/eventgt ltdategt11 Aug
1999lt/dategt lt/eventgt lteventgt lttypegtBASE
jumplt/typegt ltlocationgtTBAlt/locationgt
ltwithgtLissalt/withgt ltwithgtJanlt/withgt
lt/eventgt lt/eventsgt
8
Semi-Structured Data
  • Each row not necessarily the same structure as
    the previous row
  • Collections are modelled as Recordsets
  • File, Folder, Table, Row
  • Common features of all nodes
  • Nodes are modelled as Records
  • Rows of a Recordset, Files in a Folder
  • Unique features of each node

9
ADO 2.5 Object Model
10
URL Usage
  • Connection, Recordset, Record, Stream
  • Recordset
  • URL must point to a collection type node
  • Stream
  • URL must point to a node that has a default
    stream defined
  • Defines the context and scope for subsequent
    operations

11
URL Example
Dim conWeb As New ADODB.Connection Dim rsWeb As
New ADODB.Recordset conWeb.Open
"http//webdev.wrox.co.uk/public" rsWeb.Open
"ProASP", conWeb rsWeb.Close rsWeb.Open
"http//webdev.wrox.co.uk/public ", , _
adOpenForwardOnly, _ adLockReadOnly,
_ adCmdURLBind
12
The Record Object
  • Models a Collection entity
  • Row in a Recordset
  • File, Folder, Table, etc.
  • Fields
  • Properties of the Record
  • Sub-Records
  • Nested entities

13
Accessing a Record
  • From a Recordset

Dim recWeb As New ADODB.Record recWeb.Open rsWeb
From a URL
Dim recWeb As New ADODB.Record recWeb.Open
"http//webdev.wrox.co.uk/public"
From a Field
Dim recNode As New ADODB.Record recNode.Open
recWeb("RESOURCE_ABSOLUTEPARSENAME").Value
14
Accessing Children
Use the GetChildren method
Dim recWeb As New ADODB.Record Dim rsChildren
As New ADODB.Recordset recWeb.Open
"http//webdev.wrox.co.uk/public" Set
rsChildren recWeb.GetChildren
15
Record and Recordset Example
  • ShowHierarchy.asp

16
Record Properties
ActiveConnection Identifies the active
connection Mode Access mode for the
record ParentURL URL identifying the parent
node of the record RecordType Type of the
record Simple document, collection, structured
document Source URL or reference to the
Recordset used to open the record State Whet
her the record is open or closed
17
Record Methods
Open Opens a record based on a URL or a
Recordset Close Closes an open
record Cancel Cancels an asynchronous
operation GetChildren Returns a Recordset of the
child nodes CopyRecord Copies a file, or a node
and its children to a new location MoveRecord Mov
es a file, or a node and its children to a new
location DeleteRecord Deletes a file, or a node
and its children
18
The Stream Object
  • Provides access to the binary data
  • contents of a file
  • body of a message
  • Can be used for BLOB/text fields
  • Uses IStream interface
  • Response and Request objects
  • Recordset, Save and Open
  • MSXML, transformNodeToObject
  • CDO

19
Streaming Binary Recordsets
ADOBinaryStream.ASP Response.ContentType
"multipart/mixed" Response.Expires 0
rs.Open "authors", . . . rs.Save Response,
adPersistADTG
ADOBinaryStream.html ltOBJECT ID"dsoAuthors"
CLASSID". . ."gt ltPARAM NAME"URL"
VALUE"ADOBinaryStream.asp"gt lt/OBJECTgt
20
Streaming XML Recordsets
ADOXMLStream.asp Response.ContentType
"text/xml" Response.Buffer False
Response.Write "lt?xml version'1.0'
encoding'ISO-8859-1'?gt rs.Open "authors", . .
. rs.Save Response, adPersistXML
21
Streaming XML Data Islands
ADOXMLDataIsland.asp lt rs.Open "authors",
. . . rs.Save Response, adPersistXML gt
  • Problem
  • Not recognised as an XMLDSO (as at 12/08/99)
  • ltXML SRC"foo.asp"gtlt/XMLgt is recognised as a DSO

22
Opening Recordsets from Streams
  • Use the Request object

SendData.asp rs.Open Request, , , , adCmdFile
ltXML ID"dsoAuthors" SRC"authors.xml"gtlt/XMLgt fun
ction PostXML() var xmlHTTP new
ActiveXObject("Microsoft.XMLHTTP")
xmlHTTP.open("POST", "http/webdev.wrox.co.uk/Send
Data.asp) xmlHTTP.send(dsoAuthors.XMLDocument)

23
Transforming XML
  • Save recordset in XML DOM object

Set xmlData Server.CreateObject
("Microsoft.XMLDOM") rs.Save xmlData, adPersistXML
Load an XSL stylesheet
Set xmlStyle Server.CreateObject
("Microsoft.XMLDOM") xmlStyle.Load("bar.xsl")
Use XSL stylesheet to transform XML
xmlData.transformNodeToObject xmlStyle, Response
24
CDO and ADO
  • Fields
  • Many CDO objects provide a Fields collection
  • To, From, Subject, etc.
  • Stream
  • Access to the message content
  • Entire message or just body content

You can receive a mail message with XML as a
MIME encoded part of the message and open a
Recordset from it
25
Changes to Existing Objects
  • XML Persistence
  • Now supports hierarchical recordsets
  • Uses schemas to define structure
  • XML DSO uses DTD or heuristics
  • Error objects
  • Might not say 'Errors Occurred'

26
Summary
  • Record
  • Semi-structured storage
  • Stream
  • Data content
  • Better XML handling

27
Questions?
?
?
?
?
?
?
?
?
?
?
Write a Comment
User Comments (0)
About PowerShow.com