Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?

Showing Answers 1 - 4 of 4 Answers

Murthy

  • May 23rd, 2005
 

Dataset is connectionless and it retrieves and stores more than one table information at a single fetch whereas recordset is connection oriented and only one table data

  Was this answer useful?  Yes

Bura Pradeep Kumar

  • Jun 17th, 2005
 

RecordSet doesn't support for retrieving the records from different DataSources like SQLserver2000 and ORACLE,but DataSet supports this.RecordSet cannot transmit on the web using HTTP protocal.But we can transmit the DataSet on the Web.RecordSet is COM based implementation ie binary standard. DataSet is as XML based Representation.

  Was this answer useful?  Yes

samiksc

  • Jan 12th, 2006
 

Following are the points of differences between ADO.Net dataset and ADO recordset.

  1. DataSet is represented using XML so can travel safely over http and port 80 without concerns for a firewall etc. A recordset is an instance of a COM object and may not travel through firewalls.
  2. For the same reason as stated in point 1 a dataset could be stored in a session variable of a web application without affecting the scalability, while storing a recordset in a session variable would affect scalability.
  3. For a dataset XML is the internal representation as well as medium used for output, but for a recordset XML is merely an output format.
  4. Dataset can hold several tables at once and also stores relationships and constraints on the tables. Recordset stores only the rows returned by the given query.
  5. Using dataset you can create a virtual representation of a database whose tables come from different data sources / RDBMSs. For example you could combine emp table from a SQL Server 2000 database with a dept table of Oracle and a salary table maintained using Excel in one dataset. Recordset is limited to results of one query on one database.

The following points summarize the similarities between the two:

  1. Dataset is disconnected by its very architecture. Recordset can also work in disconnected mode.
  2. Both support batch updates.
  3. Both support filtering and sorting of data.

  Was this answer useful?  Yes

Diju

  • Mar 7th, 2006
 

In ADO, the in-memory representation of data is the recordset. In ADO.NET, it is the dataset. There are important differences between them. A recordset looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database ?that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and another table about each investor?s stock purchases, it could also contain a relationship connecting each row of the investor table with the corresponding rows of the purchase table. Because the dataset can hold multiple, separate tables and maintain information about relationships between them, it can hold much richer data structures than a recordset, including self-relating tables and tables with many-to-many relationships. 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. DataRelation objects maintain information about master and detail records and provide a method that allows you to get records related to the one you are working with. For example, starting from the row of the Investor table for "Nate Sun," you can navigate to the set of rows of the Purchase table describing his purchases. A cursor is a database element that controls record navigation, the ability to update data, and the visibility of changes made to the database by other users. ADO.NET does not have an inherent cursor object, but instead includes data classes that provide the functionality of a traditional cursor. For example, the functionality of a forward-only, read-only cursor is available in the ADO.NET DataReader object. For more information about cursor functionality, see Data Access Technologies. Minimized Open Connections: In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access. There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database ? by optimizing for performance, performing data validation checks, or adding any other extra processing. Data adapters, data connections, data commands, and data readers are the components that make up a .NET Framework data provider. Microsoft and third-party providers can make available other .NET Framework data providers that can be integrated into Visual Studio. Sharing Data Between Applications. Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset. To transmit an ADO disconnected recordset from one component to another, you use COM marshalling. To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream. Richer data types.COM marshalling provides a limited set of data types ? those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set of data types they would ordinarily use. Performance. Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions