Tuesday, April 15, 2008

ADO.Net Objects

ADO.Net has some differences from ADO. The main differences are:

  • ADO.Net is connectionless, rather than connection oriented. This means ALL datasets are disconnected. It does not mean you cannot keep a connection open, it just means that all the data you work with is a copy on the client side.
  • ADO.Net can use XML

Description

  • ADO.NET uses two types of objects to access the data in a database: datasets, which can contain one or more data tables, and .NET data provider objects, which include data adapters, commands, and connections.
  • A dataset stores data from the database so that it can be accessed by the application. The .NET data provider objects retrieve data from and update data in the database.
  • To retrieve data from a database and store it in a data table, a data adapter object issues a Select statement that’s stored in a command object. Next, the command object uses a connection object to connect to the database and retrieve the data. Then, the data is passed back to the data adapter, which stores the data in the dataset.
  • To update the data in a database based on the data in a data table, the data adapter object issues an Insert, Update, or Delete statement that’s stored in a command object. Then, the command object uses a connection to connect to the database and update the data.
  • The data provider remains connected to the database only long enough to retrieve or update the specified data. Then, it disconnects from the database and the application works with the data via the dataset object. This is referred to as a disconnected data architecture.
  • All of the ADO.NET objects are implemented by classes in the System.Data namespace of the .NET Framework. However, the specific classes used to implement the connection, command, and data adapter objects depend on the .NET data provider you use.

No comments: