Optimizing ADO.NET Code

Several ways exist to increase the performance of ADO.NET code in your Web or Windows forms applications. In this section, you'll see some direct improvements you can make to your ADO.NET code to improve the speed of your data access.

DataReader Versus DataSet

As you know, you have two different ways of retrieving data from your data source using ADO.NET. You can use a DataAdapter object to fill a DataSet with data, and then work with the data in the DataSet or display it on a form using a DataGrid or other mechanism for display. In a number of cases, you need a DataSet: You might need to perform calculations or otherwise work on several items within the DataSet at once. However, if you're just displaying data, the DataReader ...

Get Sams Teach Yourself ADO.NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.