Page 1
Moving from MicrosoftMoving from Microsoft®® ADO 2.X To ADO 2.X To ADO.NETADO.NET
Jackie GoldsteinJackie Goldstein
Renaissance Computer Systems Ltd.
MSDN Regional Director, Israel
[email protected]
Prerequisites for presentation:
I assume you know: 1) Visual Basic.NET
2) ADO 2.X
Level: Intermediate
##
Page 2
Jackie Goldstein…Jackie Goldstein… General Manager of Renaissance Computer Systems
– Consulting, Training, & Development, with Microsoft Tools & Technologies
Author of “Database Access with Visual Basic.Net”
(ISBN 0-67232-3435, Addison-Wesley) MSDN Regional Director for Israel Founder and monthly host of
IVBUG (Israel Visual Basic User Group) Speaker at local & international developer
conferences:– Microsoft Developer Days, TechEd,
– VSLive!, VBITS, VB DevCon, SQL2TheMax
Selected as SME (Subject Matter Expert) to help develop/review content for DevDays with Microsoft team in Redmond
Page 3
Session TopicsSession Topics
ADO.NET Architecture ADO.NET Object Model ADO.NET and XML Summary and Questions
Page 4
Session TopicsSession Topics
ADO.NET Architecture ADO.NET Object Model ADO.NET and XML Summary and Questions
Page 5
ADO.NETADO.NET
ADO Look and Feel… Direct OLE DB connectivity… Integrated with .NET Framework… Integrated with XML… "Designed for the Enterprise"…
Page 6
The .NET FrameworkThe .NET FrameworkApplications Are Built Using the FrameworkApplications Are Built Using the Framework
Common Language Runtime
Memory Mgmt Type System Lifetime
System Base Classes
IO Threading Security ServiceProcess
Data Oledb SQLClient XML
System.Web
Web Services Web Forms
ASP Application Services
System.Windows.Forms
Controls Drawing
Windows Application Services
Page 7
ADO.NET Object ModelADO.NET Object Model
Classic ADO styling…–Connection–Command, Parameter
…but a lot more functionality & flexibility–DataReader
Forward-only, Read-only "RecordSet"
–DataTable and DataSet
Disconnected, In-Memory Cache–DataAdapter
Connects a DataSet with a data source
Page 8
.NET Data Provider.NET Data Provider
DataReaderDataReader
CommandCommandConnectionConnection
SyncSync
Data In The .NET PlatformData In The .NET Platform
Controls,Controls,Designers,Designers,
Code-gen, etcCode-gen, etc
DataSetDataSet
XmlReaderXmlReader
XmlText-XmlText-ReaderReader
XmlNode-XmlNode-ReaderReader
XSL/T, X-Path,XSL/T, X-Path,Validation, etcValidation, etc
XmlData-XmlData-DocumentDocument
Data-Data-AdapterAdapter
Page 9
Points to Note in ADO.NET vs. ADOPoints to Note in ADO.NET vs. ADO
Separation between connected data access model and disconnected programming model
No CursorType, CursorLocation, or LockType ADO Recordset functionality is split into
smaller, specific objects, e.g. DataReader, DataTable, Command
ADO.NET allows manipulation of XML data, not just XML as I/O format
Page 10
Session TopicsSession Topics
ADO.NET Architecture ADO.NET Object Model ADO.NET and XML Summary and Questions
Page 11
.NET Data Providers.NET Data Providers
Manage interaction to a data source Microsoft Implementations
–OLEDB .NET Data Provider
–SQLServer .NET Data Provider
–ODBC .NET Data Provider
–Oracle .NET Data Provider
–Exchange .NET Data Provider Main Objects:
–Connection, Command, Parameter
–DataReader, DataAdapter
Data Data StoreStore
DataDataProviderProvider
Page 12
Demo – Demo – Using .NET Data ProvidersUsing .NET Data Providers
Connection Object Command Object DataReader Object
Page 13
DataSet Object DataSet Object
DataSetDataSet
DataTableDataTable
DataTableDataTable
DataRowDataRow
DataColumnDataColumn
RelationsRelations
ConstraintsConstraintsXML SchemaXML Schema
Page 14
DataAdapter ObjectDataAdapter Object
DataAdapterDataAdapter
SelectCommandSelectCommand
InsertCommandInsertCommand
UpdateCommandUpdateCommand
DeleteCommandDeleteCommand
TableMappingsTableMappings
DatabaseDatabase
DataSetDataSet
Page 15
Demo – Demo – Using the DataAdapterUsing the DataAdapter
Simple Fill Database Updates Using the DataAdapter Configuration
Wizard
Page 16
Strongly Typed DataSetStrongly Typed DataSet
Deal with DataSets, Tables, and Rows as Objects–Columns and Relations as properties
Class Generated At Design Time– Inherits from DataSet
–Schema coded into the class Benefits
–Statement completion
–Compile time type checking
–Concise, readable code
Page 17
Session TopicsSession Topics
ADO.NET Architecture ADO.NET Object Model ADO.NET and XML Summary and Questions
Page 18
.NET Data Provider.NET Data Provider
DataReaderDataReader
CommandCommandConnectionConnection
SyncSync
Unified ArchitectureUnified Architecture
Controls,Controls,Designers,Designers,
Code-gen, etcCode-gen, etc
DataSetDataSet
XmlReaderXmlReader
XmlText-XmlText-ReaderReader
XmlNode-XmlNode-ReaderReader
XSL/T, X-Path,XSL/T, X-Path,Validation, etcValidation, etc
XmlData-XmlData-DocumentDocument
Data-Data-AdapterAdapter
Page 19
ADO.NET And XML (1)ADO.NET And XML (1)
The DataSet– Loads/saves XML data into/out of DataSet
– Schema can be loaded/saved as XSD
– Schema can be inferred from XML Data
Page 20
ADO.NET And XML (2) ADO.NET And XML (2) Data is XML is DataData is XML is Data
XmlDataDocument unifies XML and Data– Simultaneously exposes data relationally or as XML
– Exposes a relational view over structured XML
Plugs into entire stack of XML services– Subclass of XmlDocument – it’s a DOM
– Retains fidelity of underlying document
Plugs into entire stack of Data services– Can obtain a DataSet view of an XmlDataDoc
– Relational and XML views stay in sync
Page 21
Scenarios EnabledScenarios Enabled
Simultaneously expose data relationally or as XML–Good for semi-structured data
–Multiple tools on same data Map interesting subset relationally using
schema–Use natural object model for each subset
Both DOM and DataSet can “grow up”
Page 22
Demo – Demo – Accessing XML DataAccessing XML Data
XML Navigation and Selection XML Format in ADO.NET vs. ADO
2.X Synchronization of Relational and
XML Views of data
Page 23
Session TopicsSession Topics
ADO.NET Architecture ADO.NET Object Model ADO.NET and XML Summary and Questions
Page 24
Comparison Between ADO and Comparison Between ADO and ADO.NET (1)ADO.NET (1)
FeatureADOADO.NET
Memory-resident Data Representation
RecordSet can contain one table
DataSet can contain one or more tables represented by DataTable Object
Relationship Between Multiple Tables
Require the JOIN querySupports the DataRelation object
Data VisitationScans RecordSet rows sequentially
Uses a navigation paradigm for non-sequential access
Disconnected AccessProvided by RecordSet but typically supports connected access
Communicates with standardized calls to the DataAdapter
Page 25
Comparison Between ADO and Comparison Between ADO and ADO.NET (2)ADO.NET (2)
FeatureADOADO.NET
ProgrammabilityUses Connection object to transmit commands
Uses strongly typed programming characteristics of XML
Sharing Disconnected Data Between Tiers or Components
Uses COM marshalling to transmit disconnected record set
Transmits a DataSet with an XML file
Transmitting Data Through Firewalls
Problematic because firewall are typically configured to prevent system-level requests
Supported, DataSet object use XML, which can pass through firewalls
ScalabilityDatabase locks and active database connections for long durations
Disconnected access to database data without retaining database locks
Page 26
Session SummarySession Summary
A natural evolution of ADO Designed with extensive XML support Closely integrated with the .NET
Framework Provides fast and efficient mechanisms for
connected data access and disconnected data manipulation
Try it – You’ll Like it !!!
Page 27
Questions?Questions?
Page 28
Moving from MicrosoftMoving from Microsoft®® ADO 2.X To ADO 2.X To ADO.NETADO.NET
Jackie GoldsteinJackie Goldstein
Renaissance Computer Systems Ltd.MSDN Regional Director, [email protected]
Prerequisites for presentation: I assume you know: 1) Visual Basic.NET2) ADO 2.X
Level: Intermediate
##