Following is the new Features of ADO.NET 2.0
1. Data Paging
Custom paging is one of the major requirements in ASP.NET. Similarly if we take windows application also, paging is an important feature that is required. In previous releases, we need to write stored procedure for doing paging in our applications.
But in ADO.NET, we can do is very simply. An new API "ExecutePageReader" in SQLCommand will do all the stuff for we and return only the required records. This method is very similar to ExecuteReader but it will accept two extra parameter. One is "Starting row number" and other one is for "number of rows". This will also return datareader. For example, check out the following code snippet.
Dim dr As SqlDataReader
Dim conn As New SqlConnection(Conn_str)
conn.Open()
Dim sqlc As New SqlCommand("Select * from Orders", conn)
dr = sqlc.ExecutePageReader(CommandBehavior.CloseConnection, 10, 10)
2. Asynchronous Data Access
In ADO.NET 1.x commands like ExecuteReader,ExecuteScalar and ExecuteNonQuery will synchronously execute and block the current thread. Even when we open connection to the database, current thread is blocked. But in ADO.NET 2.0, all of these methods comes with Begin and End methods to support asynchronous execution.
2. Asynchronous Data Access
In ADO.NET 1.x commands like ExecuteReader,ExecuteScalar and ExecuteNonQuery will synchronously execute and block the current thread. Even when we open connection to the database, current thread is blocked. But in ADO.NET 2.0, all of these methods comes with Begin and End methods to support asynchronous execution.
This asynchrounous methodology is very similar to our .NET framework asynchronous methodology. Even we can have callback mechanism using this approach.
This Asynchrounous Data Access is currently only supported in SQLClient, but complete API support is available for other providers to implement this mechanism.
3. Connection Details
Now we can get more details about a connection by setting Connection's StatisticsEnabled property to True. The Connection object provides two new methods - RetrieveStatistics and ResetStatistics. The RetrieveStatistics method returns a HashTable object filled with the information about the connection such as data transferred, user details, curser details, buffer information and transactions.
4. DataSet, RemotingFormat Property
When DataSet.RemotingFormat is set to binary, the DataSet is serialized in binary format instead of XML tagged format, which improves the performance of serialization and deserialization operations significantly.
5. DataTable’s Load and Save Methods
In previous version of ADO.NET, only DataSet had Load and Save methods. The Load method can load data from objects such as XML into a DataSet object and Save method saves the data to a persistent media. Now DataTable also supports these two methods.
We can also load a DataReader object into a DataTable by using the Load method.
6. New Data Controls
In Toolbox, we will see these new controls - DataGridView, DataConnector, and DataNavigator. See Figure 1. Now using these controls, we can provide navigation (paging) support to the data in data bound controls.
3. Connection Details
Now we can get more details about a connection by setting Connection's StatisticsEnabled property to True. The Connection object provides two new methods - RetrieveStatistics and ResetStatistics. The RetrieveStatistics method returns a HashTable object filled with the information about the connection such as data transferred, user details, curser details, buffer information and transactions.
4. DataSet, RemotingFormat Property
When DataSet.RemotingFormat is set to binary, the DataSet is serialized in binary format instead of XML tagged format, which improves the performance of serialization and deserialization operations significantly.
5. DataTable’s Load and Save Methods
In previous version of ADO.NET, only DataSet had Load and Save methods. The Load method can load data from objects such as XML into a DataSet object and Save method saves the data to a persistent media. Now DataTable also supports these two methods.
We can also load a DataReader object into a DataTable by using the Load method.
6. New Data Controls
In Toolbox, we will see these new controls - DataGridView, DataConnector, and DataNavigator. See Figure 1. Now using these controls, we can provide navigation (paging) support to the data in data bound controls.

Figure 1. Data bound controls.
7. DbProvidersFactories Class
This class provides a list of available data providers on a machine. We can use this class and its members to find out the best suited data provider for database when writing a database independent applications.
8. Customized Data Provider
By providing the factory classes now ADO.NET extends its support to custom data provider. Now we don't have to write a data provider dependent code. We use the base classes of data provider and let the connection string does the trick for we.
Ohter features will be released in next article.
No comments:
Post a Comment