Ado.net

ADO.NET Projects

ADO.NET Project 1

ADO.NET Examples

Examples

adplus-dvertising
Introduction of ADO .NET

Microsoft ADO.NET (ActiveX Data Objects .NET) is part of the Microsoft .NET Framework: a set of tools and layers that allows your application to easily manage and communicate with its file-based or server-based data store.ADO.NET (ActiveX Data Objects .NET)is the primary data access API for the .NET Framework.

It provides the classes that you use as you develop database applications with Visual Basic .NET as well as other .NET languages. Ado.net consists of classes that allow a .NET application to connect to the data source, executes commands and manage disconnected data.In the .NET Framework, the ADO.NET libraries appear under the System.Data namespace.These libraries include functionality to connect to these data sources, execute commands,and store, manipulate, and retrieve data.

ADO.net Tutorials
Various .NET Data Providers
Data Source Name Provider Name
ODBC System.Data.Odbc
OLE DBSystem.Data.OleDb
Oracle client software version 8.1.7System.Data.Oracle Client
Entity Data Model (EDM) applicationsSystem.Data.EntityClient
Microsoft SQL Server Compact 4.0System.Data.SqlServerCe
SQL ServerSystem.Data.SqlClient
ADO .NET Architecture

The two key components of ADO.NET are Data Providers and DataSet . The .Net Framework includes mainly three Data Providers for ADO.NET. They are the Microsoft SQL Server Data Provider, OLEDB Data Provider and ODBC Data Provider. SQL Server uses the SqlConnection object , OLEDB uses the OleDbConnection Object and ODBC uses OdbcConnection Object respectively.

Data Provider

The Data Provider is used for providing and maintaining the connection to the database. A DataProvider is a collection of related components that work together to provide data in an efficient and performance driven mannern.

The .net framwork has two DataProviders: the SQL Data Provider which is designed only to work with Microsoft's SQL Server 7.0 or later and the OleDb DataProvider which allows us to connect to other types of databases like Access and Oracle. Each DataProvider consists of the following component classes:

  1. The Connection object - It provides a connection to the database
  2. The Command object - It is used to execute a command.
  3. The DataReader object- It provides a forward-only, read only, connected recordset.
  4. The DataAdapter object- It populates a disconnected DataSet with data and performs update.
Data SET

The dataset is a disconnected, in-memory representation of data. It can be defined as a local copy of the relevant portions of the database.DataSet consists of a collection of DataTable objects that you can relate to each other with DataRelation objects. The DataTable is a collection of DataRow and DataCoulumn Object which contains Data.

The DataAdapter Object create a bridge between the DataSet and the Data Source The DataSet is persisted in memory and the data in it can be manipulated and updated independent of the database. When the use of this DataSet is finished, changes can be made back to the central database for updating. The data in DataSet can be loaded from any valid data source like Microsoft sql database an oracle atabase or from a Microsoft Access database.

ADO VS ADO .NET
ADO ADO .NET
ADO works with connected dataADO.NET uses data in a disconnected fashion
In ADO, the in-memory representation of data is the recordset.In ADO.NET, it is the dataset
In ADO you scan sequentially through the rows of the recordset using the ADO MoveNext method. In ADO.NET, rows are represented as collections, so you can loop through a table as you would through any collection,or access particular rows via ordinal or primary key index.
ADO's are stateful(TCP/IP)ADO.NET's are stateless(internet)
ADO objects communicate in binary mode.ADO.NET uses XML for passing the data.
ADO allows you to create client-side cursors onlyADO.NET gives you the choice of either using client-side or server-side cursors.
Derives information about data implicitly at run time, based on metadata that is often expensive to obtain.Leverages known metadata at design time in order to provide better run-timeperformance and more consistent run-time behavior.
Includes implicit behaviors that may not always be required in an application and that may therefore limit performance.Includes implicit behaviors that may not always be required in an application and that may therefore limit performance.
Feature of ADO .NET

The salient features of ADO.NET

  • Enhancements to the DataSet and Datatable classes
  • Optimized DataSet Serialization
  • Conversion of a DataReader to a DataSet or a DataTable and vice versa
  • Data Paging
  • Batch Updates — Reduction in database roundtrips
  • Asynchronous Data Access
  • Common Provider Model
  • Bulk Copy
  • Advantage of ADO .NET
    1. ADO.NET Does Not Depend On Continuously Live Connections.
    2. Database Interactions Are Performed Using Data Commands.
    3. Data Can Be Cached in Datasets.
    4. Datasets Are Independent of Data Sources.
    5. Data Is Persisted as XML.
    6. Schemas Define Data Structure