what’s new in ado 2.5 greg hinkel program manager data access group [email protected]

37

Upload: scott-collins

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com
Page 2: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

What’s new in ADO 2.5What’s new in ADO 2.5

Greg HinkelGreg HinkelProgram ManagerProgram ManagerData Access GroupData Access [email protected]@microsoft.com

Page 3: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

AgendaAgenda

Quick overviewQuick overview Semi-structured DataSemi-structured Data URL bindingURL binding Record ObjectRecord Object Changes to the Fields collectionChanges to the Fields collection Stream ObjectStream Object Performance and XMLPerformance and XML

Page 4: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

ADO OverviewADO Overview

A powerful consumer interfaceA powerful consumer interface Flexible Flexible Works with many languagesWorks with many languages High Performance with a simple High Performance with a simple

Object ModelObject Model

Page 5: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

ADO 2.1 - Object ModelADO 2.1 - Object Model

ConnectionConnection

CommandCommand

RecordsetRecordset

ErrorsErrorsParametersParameters

FieldsFields

Page 6: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Semi-structured dataSemi-structured data What is it?What is it?

Non-rectangularNon-rectangular Structured Structured navigatablenavigatable

Examples:Examples: A file systemA file system Mail in a public folder or inboxMail in a public folder or inbox Web pages or document storeWeb pages or document store

Page 7: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Semi-structured data(cont.)Semi-structured data(cont.) Tree structuredTree structured

Can have arbitrary depthCan have arbitrary depth

Each node has a set of propertiesEach node has a set of properties Each node may have a different set of Each node may have a different set of

properties or attributesproperties or attributes

Non-leaf nodes are collections Non-leaf nodes are collections Leaf-nodes have interesting contentLeaf-nodes have interesting content

Page 8: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Working with semi-structured Working with semi-structured datadata PropertiesProperties

Get, Set, Add and DeleteGet, Set, Add and Delete

Scoped OperationsScoped Operations Move, Copy, Delete apply to all contained Move, Copy, Delete apply to all contained

itemsitems

QueryingQuerying Find items that satisfy search criteriaFind items that satisfy search criteria

Must be efficientMust be efficient

Page 9: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

ADO 2.5 - Design GoalsADO 2.5 - Design Goals

Keep it simple!Keep it simple! Allow the use of URLsAllow the use of URLs Do scoped operationsDo scoped operations Manipulate text or binary streamsManipulate text or binary streams

Page 10: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

ADO 2.5 - Object ModelADO 2.5 - Object Model

ConnectionConnection

CommandCommand

RecordsetRecordset

ErrorsErrors

FieldsFields

ParametersParameters

RecordRecord StreamStream

Page 11: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Semi-structured data and Semi-structured data and ADO 2.5ADO 2.5 Recordsets Recordsets

RectangularRectangular Properties as fieldsProperties as fields Directories, filesDirectories, files

Record Record Properties as fields, only moreProperties as fields, only more Superset of recordset fieldsSuperset of recordset fields Collection or fileCollection or file Can use a Stream objectCan use a Stream object

Page 12: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

URL bindingURL binding URLs identify objectsURLs identify objects

nodesnodes Individual files Individual files

URL binding forURL binding for ConnectionConnection RecordsetRecordset RecordRecord StreamStream

The RootBinder cracks URLsThe RootBinder cracks URLs

Page 13: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Dim conn As New ConnectionDim conn As New Connection

Dim rec As New Record Dim rec As New Record

Dim rec2 As New RecordDim rec2 As New Record

conn.Open "URL=http://MC/davfs/"conn.Open "URL=http://MC/davfs/"

rec.Open "TestFolder", connrec.Open "TestFolder", conn

rec2.Open " TestFolder ", _ rec2.Open " TestFolder ", _ "URL=https://MC/davfs/“"URL=https://MC/davfs/“

Page 14: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Record Object Record Object adCollectionRecord or adCollectionRecord or

adSimpleRecordadSimpleRecord Folders, filesFolders, files A row of a recordsetA row of a recordset Contents exposed as a streamContents exposed as a stream Has a collection of propertiesHas a collection of properties Scopes operationsScopes operations Use GetChildren to obtain a recordsetUse GetChildren to obtain a recordset

Page 15: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Opening a Record ObjectOpening a Record Object

URL binding rec.Open "bingo.txt", _ rec.Open "bingo.txt", _

"URL=http://MC/davfs/“"URL=http://MC/davfs/“ rec.Open , _ rec.Open , _

"URL=http://MC/davfs/bingo.txt“"URL=http://MC/davfs/bingo.txt“ rec.Open “bingo.txt”, connrec.Open “bingo.txt”, conn

From a recordset rec.Open rsrec.Open rs

Page 16: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Record PropertiesRecord Properties ActiveConnectionActiveConnection ModeMode Access rightsAccess rights ParentURLParentURL RecordTypeRecordType SSimple record, collection imple record, collection

or structured documentor structured document StateState OOpen, closed, pen, closed,

fetchingfetching SourceSource URL or rsURL or rs

Page 17: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Record Methods Record Methods CancelCancel CloseClose CopyRecordCopyRecord DeleteRecordDeleteRecord MoveRecordMoveRecord GetChildrenGetChildren OpenOpen

Page 18: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Dim rec As New RecordDim rec As New Record

Dim rs As New RecordsetDim rs As New Recordset

rec.Open "TestFolder", _ rec.Open "TestFolder", _ "URL=http://MC/davfs/”"URL=http://MC/davfs/”

if rec.RecordType = adRecCollection then if rec.RecordType = adRecCollection then

Set rs = rec.GetChildrenSet rs = rec.GetChildren

‘‘do stuff with recordsetdo stuff with recordset

end ifend if

Page 19: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Fields of a Record objectFields of a Record object A field is a property A field is a property

Title, size, last modified time, Subject, Title, size, last modified time, Subject, To, CC, BCCTo, CC, BCC

Fields are a collection on the record Fields are a collection on the record objectobject

Similar to the recordset’s field Similar to the recordset’s field collectioncollection

Can add, delete or change valuesCan add, delete or change values

Page 20: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Dim rec As New RecordDim rec As New Record

Dim fld As FieldDim fld As Field

rec.Open “TestFolder", _ rec.Open “TestFolder", _ "URL=http://MC/davfs""URL=http://MC/davfs"

‘‘loop thru the fieldsloop thru the fields

For Each fld In rec.FieldsFor Each fld In rec.Fields

Debug.Print fld.Name, " = ", fld.ValueDebug.Print fld.Name, " = ", fld.Value

NextNext

Page 21: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

The Recordset ObjectThe Recordset Object Container of itemsContainer of items Tabular rather than tree viewTabular rather than tree view Contains “common” propertiesContains “common” properties Use record to view “uncommon” Use record to view “uncommon”

propertiesproperties Open directly or use GetChildren Open directly or use GetChildren Use Record and Recordset for Use Record and Recordset for

navigationnavigation

Page 22: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Variable number of FieldsVariable number of Fields

Each row contained in a recordset Each row contained in a recordset maymay have a different set of columns have a different set of columns Must share “common” propertiesMust share “common” properties Superset of the recordset’s fields Superset of the recordset’s fields

collection collection Add/delete fields from a record objectAdd/delete fields from a record object But only for fields that are unique to that But only for fields that are unique to that

recordrecord

Page 23: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Dim rs As New RecordsetDim rs As New Recordset

Dim rec As New RecordDim rec As New Record

rs.Open “TestFolder", _ rs.Open “TestFolder", _ "URL=http://MC/davfs""URL=http://MC/davfs"

While Not rs.EOFWhile Not rs.EOF

rec.Open rsrec.Open rs

Debug.Print rec.Fields.CountDebug.Print rec.Fields.Count

rec.Closerec.Close

rs.MoveNextrs.MoveNext

WendWend

Page 24: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

The Fields collectionThe Fields collection New or changed methodsNew or changed methods

AppendAppend Optionally provide the value UpdateUpdate CancelUpdateCancelUpdate ResyncResync Retrieves values from the data

store

Page 25: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

rec.Open "bingo.txt", "URL=http://MC/davfs/"rec.Open "bingo.txt", "URL=http://MC/davfs/"

rec.Fields.Append "AssignedTo", adChar, _ rec.Fields.Append "AssignedTo", adChar, _

30, adFldIsNullable, "Tim Brown"30, adFldIsNullable, "Tim Brown"

rec.Fields.Append "Processed", adBoolean, , , rec.Fields.Append "Processed", adBoolean, , , FalseFalse

rec.Fields.Update rec.Fields.Update

rec.Open "bingo.txt",rec.Open "bingo.txt","URL=http://MC/davfs/""URL=http://MC/davfs/"

rec.Fields("AssignedTo") = "Tim Brown"rec.Fields("AssignedTo") = "Tim Brown"

rec.Fields("Processed") = Falserec.Fields("Processed") = False

rec.Fields.Updaterec.Fields.Update

Page 26: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Field object changesField object changes New PropertiesNew Properties

StatusStatus TypeType adDefaultStream, adDefaultStream,

adRecordURLadRecordURL OriginalValueOriginalValue UnderlyingValueUnderlyingValue

Page 27: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Stream ObjectStream Object Binary or text streamBinary or text stream Implemented on top of IStream Implemented on top of IStream

interfaceinterface Leaf records have a default Leaf records have a default

stream, stream, adDefaultStreamadDefaultStream content of an email messagecontent of an email message Contents of a fileContents of a file

Page 28: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Stream PropertiesStream Properties CharsetCharset Specifies the character Specifies the character

set set

EOSEOS

LineSeparatorLineSeparator

ModeMode AccessAccess permissions permissions

PositionPosition

SizeSize

StateState open, closed or fetchingopen, closed or fetching

TypeType binary or textbinary or text

Page 29: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Stream Methods (1 of 2)Stream Methods (1 of 2) CancelCancel

CloseClose

CopyToCopyTo another streamanother stream

FlushFlush

LoadLoadFromFileFromFile

OpenOpen

Page 30: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Stream Methods (2 of 2)Stream Methods (2 of 2) ReadRead binarybinary

ReadTextReadText numchars or numchars or adReadLineadReadLine

SaveToFile adSaveCreateOverWrite

SetEOSSetEOS

SkipLineSkipLine

WriteWrite binarybinary

WriteTextWriteText adWriteLineadWriteLine

Page 31: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Dim strm As New StreamDim strm As New Stream

strm.Openstrm.Open

strm.LoadFromFile _ "C:\inetpub\davfs\strm.LoadFromFile _ "C:\inetpub\davfs\bingo.txt"bingo.txt"

Debug.Print strm.SizeDebug.Print strm.Size

Debug.Print strm.Type 'adTypeTextDebug.Print strm.Type 'adTypeText

strm.Charset = "ascii"strm.Charset = "ascii"

Debug.Print strm.ReadTextDebug.Print strm.ReadText

strm.SaveToFile "C:\CopyOfBingo.txt"strm.SaveToFile "C:\CopyOfBingo.txt"

Page 32: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Performance Performance

Faster than ADO 2.1Faster than ADO 2.1 Improved scripting language Improved scripting language

performanceperformance Much better on multiple processor Much better on multiple processor

machinesmachines Windows 2000 will have an IMDB Windows 2000 will have an IMDB

providerprovider ADO Performance Tuning ADO Performance Tuning (11-311)(11-311)

Page 33: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

XMLXML ASPASP

rs.Save Response, adPersistXMLrs.Save Response, adPersistXML rs2.Open Requestrs2.Open Request

FileFile rs.Save “C:\authors.xml”, adPersistXMLrs.Save “C:\authors.xml”, adPersistXML rs2.Open “C:\authors.xml”rs2.Open “C:\authors.xml”

StreamStream rs.Save strm, adPersistXMLrs.Save strm, adPersistXML rs2.Open strmrs2.Open strm

Can save a recordset into DOM Can save a recordset into DOM Shape, can now save as XMLShape, can now save as XML

Page 34: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

ADO 2.5 - SummaryADO 2.5 - Summary

Extends ADO to work with semi-Extends ADO to work with semi-structured data provided by OLE DB structured data provided by OLE DB 2.5 providers2.5 providers

Enables web-publishing and Enables web-publishing and document managementdocument management

Performance gains and increased XML Performance gains and increased XML capabilitiescapabilities

MDAC 2.5 shipping with Windows MDAC 2.5 shipping with Windows 20002000 Available in Beta3Available in Beta3 Some changes post Beta3Some changes post Beta3

Page 35: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Feedback and InformationFeedback and Information

Newsgroups and web site:Newsgroups and web site: http://www.microsoft.com/data/http://www.microsoft.com/data/ microsoft.public.data.oledbmicrosoft.public.data.oledb microsoft.public.data.ado microsoft.public.data.ado microsoft.public.data.ado.rds microsoft.public.data.ado.rds

FeedbackFeedback MDACMDAC: [email protected]: [email protected] ADOADO: [email protected]: [email protected] OLE DBOLE DB: [email protected]: [email protected] ODBCODBC: [email protected]: [email protected]

Page 36: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com

Tech Ed Data SessionsTech Ed Data Sessions ADO for Non-Database DevelopersADO for Non-Database Developers

(11-404)(11-404)

ADO Performance Tuning ADO Performance Tuning (11-311)(11-311)

COM Database Programming: High COM Database Programming: High Speed Data Access from Visual C++® Speed Data Access from Visual C++® Via OLE DB Via OLE DB (11-321)(11-321)

New XML Integration Features with New XML Integration Features with ADO 2.5 ADO 2.5 (11-314)(11-314)

Understanding OLE DB 2.5 Understanding OLE DB 2.5 (11-402)(11-402)

What's New in ADO 2.5 What's New in ADO 2.5 (11-306 )(11-306 )

Page 37: What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com