Download presentation
Presentation is loading. Please wait.
Published byScott Collins Modified over 9 years ago
2
What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group greghin@microsoft.com
3
Agenda Quick overview Semi-structured Data URL binding Record Object Changes to the Fields collection Stream Object Performance and XML
4
ADO Overview A powerful consumer interface Flexible Works with many languages High Performance with a simple Object Model
5
ADO 2.1 - Object Model Connection Command Recordset Errors Parameters Fields
6
Semi-structured data What is it? Non-rectangular Non-rectangular Structured Structured navigatable navigatable Examples: A file system A file system Mail in a public folder or inbox Mail in a public folder or inbox Web pages or document store Web pages or document store
7
Semi-structured data(cont.) Tree structured Can have arbitrary depth Can have arbitrary depth Each node has a set of properties Each node may have a different set of properties or attributes Each node may have a different set of properties or attributes Non-leaf nodes are collections Leaf-nodes have interesting content
8
Working with semi-structured data Properties Get, Set, Add and Delete Get, Set, Add and Delete Scoped Operations Move, Copy, Delete apply to all contained items Move, Copy, Delete apply to all contained items Querying Find items that satisfy search criteria Find items that satisfy search criteria Must be efficient
9
ADO 2.5 - Design Goals Keep it simple! Allow the use of URLs Do scoped operations Manipulate text or binary streams
10
ADO 2.5 - Object Model Connection Command Recordset Errors Fields Parameters RecordStream
11
Semi-structured data and ADO 2.5 Recordsets Rectangular Rectangular Properties as fields Properties as fields Directories, files Directories, files Record Properties as fields, only more Properties as fields, only more Superset of recordset fields Superset of recordset fields Collection or file Collection or file Can use a Stream object Can use a Stream object
12
URL binding URLs identify objects nodes nodes Individual files Individual files URL binding for Connection Connection Recordset Recordset Record Record Stream Stream The RootBinder cracks URLs
13
Dim conn As New Connection Dim rec As New Record Dim rec2 As New Record conn.Open "URL=http://MC/davfs/" rec.Open "TestFolder", conn rec2.Open " TestFolder ", _ "URL=https://MC/davfs/“
14
Record Object adCollectionRecord or adSimpleRecord Folders, files A row of a recordset Contents exposed as a stream Has a collection of properties Scopes operations Use GetChildren to obtain a recordset
15
Opening a Record Object URL binding rec.Open "bingo.txt", _ "URL=http://MC/davfs/“ rec.Open "bingo.txt", _ "URL=http://MC/davfs/“ rec.Open, _ "URL=http://MC/davfs/bingo.txt“ rec.Open, _ "URL=http://MC/davfs/bingo.txt“ rec.Open “bingo.txt”, conn rec.Open “bingo.txt”, conn From a recordset rec.Open rs rec.Open rs
16
Record Properties ActiveConnection ModeAccess rights ParentURL RecordTypeSimple record, collection or structured document StateOpen, closed, fetching SourceURL or rs
17
Record Methods Cancel Close CopyRecord DeleteRecord MoveRecord GetChildren Open
18
Dim rec As New Record Dim rs As New Recordset rec.Open "TestFolder", _ "URL=http://MC/davfs/” if rec.RecordType = adRecCollection then Set rs = rec.GetChildren ‘do stuff with recordset end if
19
Fields of a Record object A field is a property Title, size, last modified time, Subject, To, CC, BCC Title, size, last modified time, Subject, To, CC, BCC Fields are a collection on the record object Similar to the recordset’s field collection Can add, delete or change values
20
Dim rec As New Record Dim fld As Field rec.Open “TestFolder", _ "URL=http://MC/davfs" ‘loop thru the fields For Each fld In rec.Fields Debug.Print fld.Name, " = ", fld.Value Debug.Print fld.Name, " = ", fld.ValueNext
21
The Recordset Object Container of items Tabular rather than tree view Contains “common” properties Use record to view “uncommon” properties Open directly or use GetChildren Use Record and Recordset for navigation
22
Variable number of Fields Each row contained in a recordset may have a different set of columns Must share “common” properties Must share “common” properties Superset of the recordset’s fields collection Superset of the recordset’s fields collection Add/delete fields from a record object Add/delete fields from a record object But only for fields that are unique to that record But only for fields that are unique to that record
23
Dim rs As New Recordset Dim rec As New Record rs.Open “TestFolder", _ "URL=http://MC/davfs" While Not rs.EOF rec.Open rs rec.Open rs Debug.Print rec.Fields.Count Debug.Print rec.Fields.Count rec.Close rec.Close rs.MoveNext rs.MoveNextWend
24
The Fields collection New or changed methods Append AppendOptionally provide the value Update Update CancelUpdate CancelUpdate Resync ResyncRetrieves values from the data store
25
rec.Open "bingo.txt", "URL=http://MC/davfs/" rec.Fields.Append "AssignedTo", adChar, _ 30, adFldIsNullable, "Tim Brown" rec.Fields.Append "Processed", adBoolean,,, False rec.Fields.Update rec.Open "bingo.txt","URL=http://MC/davfs/" rec.Fields("AssignedTo") = "Tim Brown" rec.Fields("Processed") = False rec.Fields.Update
26
Field object changes New Properties Status Status Type adDefaultStream, adRecordURL Type adDefaultStream, adRecordURL OriginalValue OriginalValue UnderlyingValue UnderlyingValue
27
Stream Object Binary or text stream Implemented on top of IStream interface Leaf records have a default stream, adDefaultStream content of an email message content of an email message Contents of a file Contents of a file
28
Stream Properties Charset Specifies the character set EOS LineSeparator Mode Access permissions Position Size State open, closed or fetching Type binary or text
29
Stream Methods (1 of 2) Cancel Close CopyToanother stream Flush LoadFromFile Open
30
Stream Methods (2 of 2) Read binary ReadText numchars or adReadLine SaveToFile adSaveCreateOverWrite SetEOS SkipLine Write binary WriteText adWriteLine
31
Dim strm As New Stream strm.Open strm.LoadFromFile _ "C:\inetpub\davfs\bingo.txt" Debug.Print strm.Size Debug.Print strm.Type 'adTypeText strm.Charset = "ascii" Debug.Print strm.ReadText strm.SaveToFile "C:\CopyOfBingo.txt"
32
Performance Faster than ADO 2.1 Improved scripting language performance Much better on multiple processor machines Windows 2000 will have an IMDB provider ADO Performance Tuning (11-311)
33
XML ASP rs.Save Response, adPersistXML rs.Save Response, adPersistXML rs2.Open Request rs2.Open Request File rs.Save “C:\authors.xml”, adPersistXML rs.Save “C:\authors.xml”, adPersistXML rs2.Open “C:\authors.xml” rs2.Open “C:\authors.xml” Stream rs.Save strm, adPersistXML rs.Save strm, adPersistXML rs2.Open strm rs2.Open strm Can save a recordset into DOM Shape, can now save as XML
34
ADO 2.5 - Summary Extends ADO to work with semi- structured data provided by OLE DB 2.5 providers Enables web-publishing and document management Performance gains and increased XML capabilities MDAC 2.5 shipping with Windows 2000 Available in Beta3 Available in Beta3 Some changes post Beta3 Some changes post Beta3
35
Feedback and Information Newsgroups and web site: http://www.microsoft.com/data/ microsoft.public.data.oledb microsoft.public.data.ado microsoft.public.data.ado.rds Feedback MDAC: mdac@microsoft.com ADO: adodoc@microsoft.com OLE DB: oledbdoc@microsoft.com ODBC: odbcdoc@microsoft.com
36
Tech Ed Data Sessions ADO for Non-Database Developers (11-404) ADO Performance Tuning (11-311) COM Database Programming: High Speed Data Access from Visual C++® Via OLE DB (11-321) New XML Integration Features with ADO 2.5 (11-314) Understanding OLE DB 2.5 (11-402) What's New in ADO 2.5 (11-306 )
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.