ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA.

Slides:



Advertisements
Similar presentations
1 /28 Introduzione a ADO.NET Silvano Coriani Developer & Platform Evangelism MCTrainer MCSDeveloper MCADeveloper MCSEInternet MCDBA.
Advertisements

17. Data Access ADO.Net Architecture New Features of ADO.NET
ADO.Net Modelo para acesso a dados nas aplicação.Net Componentes: DataSet.Net Data providers: Connection Command DataReader DataAdapter.
Database Connections with ASP.Net
ADO vs ADO.NET ADOADO.NET Client/server coupledDisconnected collection of data from data server Uses RECORDSET object (contains one table) Uses DATASET.
1 Interface IDbConnection ConnectionString defines data base connection Open and close connection Properties of connection object Creates Command-Object.
Direct Data Access, Data Binding. Content Direct Data Access Data Binding Muzaffer DOĞAN - Anadolu University2.
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
VB.NET Database Access ISYS546. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
1 ADO.NET. 2.NET Framework Data Namespaces System.Data –Base set of classes and interfaces for ADO.NET System.Data.Common –Classes shared by the.NET Data.
VB.NET Database Access ISYS 812. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Programming in ADO.NET: Data-Centric Applications and ADO.NET Original copyright by Microsoft, 2002, with minor modifications by Dan Eaves, 2005.
Chapter 9 Using the SqlDataSource Control. References aspx.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
ADO.NET Tools and Wizards. Slide 2 Data Sources Window (Introduction) Use the Data Sources window to Establish a connection Create bound control instances.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Chapter 3 Introduction to ADO.NET 3.1 The ADO and ADO.NET ActiveX Data Object (ADO) is developed based on Object Linking and Embedding (OLE) and Component.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
ASP.NET Rina Zviel-Girshin Lecture 5
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
Module 2: Connecting to Data Sources. Overview Choosing a.NET Data Provider Defining a Connection Managing a Connection Handling Connection Exceptions.
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Introduction to ADO.NET ADO.NET - Lesson 01  Training time: 10 minutes  Author:
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
An Introduction to ADO.Net Marmagna Desai.NET Seminar, Fall-2003.
Module 3: Performing Connected Database Operations.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
DEV383 The ADO.NET DataSet and You Jackie Goldstein General Manager Renaissance Computer Systems
Accessing Data with Microsoft Visual C# Applications.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
C# .NET Software Development
Active Data Objects Using.Net ADO.Net Farooq Ahmed Amna Umber Summayya Shehzad.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Data Access. ADO.NET ADO.NET is the primary library for building database solutions within the.NET Framework. ADO.NET does not replace ADO. ADO and OLEDB.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
.NET Data Access and Manipulation
DAT 390 Advanced ADO.NET Programming Techniques Jackie Goldstein Renaissance Computer Systems
ASP.NET Programming with C# and SQL Server First Edition
Data Access with ADO.NET
Introduction to ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
ADO.NET and Stored Procedures
ADO.NET Framework.
Programming the Web Using ASP.Net
Lecture 6 VB.Net SQL Server.
Active Data Objects Binding ASP.NET Controls to Data
ADO.NET Accessing Databases in VS.NET
VB.NET Using Database.
Tonga Institute of Higher Education
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 ADO.
PROG Advanced Web Apps 4/13/2019 Programming Data Pages Wendi Jollymore, ACES.
Active Data Objects Binding ASP.NET Controls to Data
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Introduction to Database Programming through ADO. NET
Presentation transcript:

ADO.NET: Working in Disconnected Environment Sergey Baidachni MCT, MCSD, MCDBA

Overview Introduction Architecture of ADO.NET ObjectSpaces – New technologies

Introduction Data Storage Connected environment Disconnected environment ADO.NET vs. ADO Demonstration (ADO.NET and Excel)

Data Storage ADO.NET Relational Database Data storage - method of storing specific items that together constitute a unit of information. Hierarchical SQL ServerOracle Access XML StructuredUnstructured Excel Active Directory CSV

Connected Environment (Scenario) 1. Open connection 2. Execute command 3. Process rows in reader 4. Close reader 5. Close connection

Connected Environment Working with data directly via open connection Advantages  Simple security realization  Work with real data  Simple organization of distributed work Drawbacks  Continual connection  Not available via Internet

Disconnected Environment (Scenarion) 1. Open connection 2. Fill the DataSet 3. Close connection 4. Process the DataSet 5. Open connection 6. Update the data source 7. Close connection

Disconnected Environment Storage of data local copy from repository Possibility to update the main data source Advantages  Economy of server resources  Does not require continual connection Drawbacks  Demands conflict resolution while data update  Data is not always up to date

ADO.NET vs. ADO ADO Connection Command RecordSet ADO.NET XxxConnection XxxTransaction XxxCommand XxxDataReader XxxDataAdapter DataSet

Demonstration OleDbConnection conn=new OleDbConnection(); OleDbCommand comm=new OleDbCommand(); OleDbDataAdapter adapt=new OleDbDataAdapter(comm); DataSet data=new DataSet(); conn.ConnectionString= “Provider=Microsoft.Jet.OLEDB.4.0; c:\myexcel.xls;Extended Properties=""Excel 8.0;HDR=NO""“; comm.Connection=conn; comm.CommandText=“select * from [Sheet1$]”; adapt.Fill(data);

Architecture of ADO.NET Data providers What does it look like? Connection to the source Command creation Cursors Data storage in memory DataAdapter – automatic data upload XML Integration

.NET Data Providers Concept of data provider Provider types  SQL.NET Data Provider  Oracle.NET Data Provider  OleDB.NET Data Provider  Odbc.NET Data Provider How to select data provider

Как это выглядит.NET Data Provider Connection Command DataReader DataAdapter DataSet DataTable DataRelation DataColumn DataRow DataConstraint SelectCommand InsertCommand DeleteCommand UpdateCommand

Connection What is Connection? Define Connection  SqlConnection conn=new SqlConnection();  Conn.ConnectionString=“User ID=sa;password=; Data Source=MyServer;Initial Catalog=Northwind;” ConnectionString Parameters  Provider  Data Source  Initial Catalog  Integrated Security  UserID/Password

Connection (Error and Pooling) System.Data.SqlClient.SqlException Errors collection SqlError  Class  LineNumber  Message  Number Pooling and Dispose method

Command Object A command object is a reference to a SQL statement or stored procedure Properties  Connection  CommandType  CommandText  Parameters Methods  ExecuteNonQuery  ExecuteReader  ExecuteScalar

DataReader Object What is query? Forward-only cursor Read method  Read next record  Return true if record is exist IsDbNull Close method NextResult – for multiply select statements

What Are DataSets and DataTables ServerData Store Database Connection Stored Procedure DataSet DataTable

The DataSet Object Model Common collections  Tables (collection of DataTable objects)  Relations (collection of DataRelation objects) Data binding to Web and Windows controls supported Schema can be defined programmatically or using XSD DataRow DataColumn DataTable DataRelation Constraints

What Is a DataAdapter? Data source DataAdapter DataTable DataSet DataAdapter Fill Update Fill Update

The XxxDataAdapter Object Model sp_SELECT XxxCommand SelectCommandUpdateCommandInsertCommandDeleteCommand XxxDataAdapter XxxCommand XxxConnection sp_UPDATEsp_INSERTsp_DELETE XxxDataReader

Demo

XML Support ADO.NET is tightly integrated with XML Using XML in a disconnected application XML Web Services DataSet Request data11 SQL query22 Results33 XML 44 Updated XML 55 SQL updates66 Data SourceClient DataSet

Object Spaces Introduction to problem What is Object Spaces? What do we need? How can we resolve the problem

Introduction to Problem There’s something apparently missing Current situation Database public struct Customer { int customerID; string customerName; } ….. Customer LoadCustomer(int id){…} void SaveCustomer(Customer obj){…}

What is Object Spaces? Relation between object and database Way to avoid long-drawn coding ObjectSpace Database Map Files

What do we need? Single table to single Object Object hierarchy to many tables Object hierarchy to single table Single Object to multiple tables Inheritance  All types in single table  Table for base type and related table per derived type

How we can resolve problem XML Again! RSD – Relational Schema Definition OSD – Object Schema Definition MSD – Mapping Schema definition MappingSchema class

RSD Tables, fields and relations descriptions

OSD Objects description

MSD Mapping Schemes

ObjectSpace methods BeginTransaction Commit Rollback GetObject GetObjectReader GetObjectSet MarkForDeletion PersistChanges Resync StartTracking

msdn.microsoft.com/library