Ado.Net – Introduction
ADO.NET stands for ActiveX Data Objects for .NET. It refers to the suite of data access technologies used to manipulate databases. ADO.NET is part of the .NET Framework.ADO 1.0 was released represented a new way of dynamically retrieving data from a database. Though ADO was at its very infancy then, and was something of an offshoot of DAO and RDO, nevertheless it represented a new bold direction.
This new data component, introduced with .NET, presented an exciting new approach to data access. Though the techniques, and logic used to connect to databases with ADO.NET weren’t startlingly different from those used with its predecessor, ADO.NET had a lot to offer. What was unique about this technology was the architecture beneath it all, its powerful approach to data management, and the flexibility in the next level of data-presenting devices.
Features of ADO.NET
- Bulk Copy OperationBulk copy classes provides the fastest way to transfer set of data from once source to the other. Each ADO.NET data provider provides bulk copy classes. For example, in SQL .NET data provider, the bulk copy operation is handled by SqlBulkCopy class, which can read a DataSet, DataTable, DataReader, or XML objects.
- Batch Update Batch update can provide a huge improvement in the performance by making just one round trip to the server for multiple batch updates, instead of several trips if the database server supports the batch update feature. The UpdateBatchSize property provides the number of rows to be updated in a batch. This value can be set up to the limit of decimal.
- Data Paging Now command object has a new execute method called ExecutePageReader. This method takes three parameters – CommandBehavior, startIndex, and pageSize. So if you want to get rows from 101 – 200, you can simply call this method with start index as 101 and page size as 100.
- Connection Details Now you 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.
- DataSet.RemoringFor mat PropertyWhen DataSet.RemotingFor mat 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.
DbProvidersFactorie s Class This class provides a list of available data providers on a machine. You can use this class and its members to find out the best suited data provider for your database when writing a database independent applications.
Customized Data Provider By providing the factory classes now ADO.NET extends its support to custom data provider. Now you don’t have to write a data provider dependent code. You use the base classes of data provider and let the connection string does the trick for you.
DataReader’s New Execute Methods Now command object supports more execute methods. Besides old ExecuteNonQuery, ExecuteReader, ExecuteScaler, and ExecuteXmlReader, the new execute methods are ExecutePageReader, ExecuteResultSet, and ExecuteRow. Figure 2 shows all of the execute methods supported by the command object in ADO.NET 2.0.