O'Reilly logo

Professional Visual Basic 2012 and .NET 4.5 Programming by Todd Herman, Gastón Hillar, David McCarter, Rob Windsor, Billy Hollis, Bill Sheldon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic ADO.NET Features

This chapter begins with a quick look at the basics of ADO.NET and then provides an overview of ADO.NET capabilities, namespaces, and classes. It also reviews how to work with the Connection, Command, DataAdapter, DataSet, and DataReader classes. Later chapters will cover some of the more recently added ADO.NET features.

Common ADO.NET Tasks

Before jumping into the depths of ADO.NET, step back and make sure that you understand some of the common tasks you might perform programmatically within ADO.NET. This section looks at the process of selecting, inserting, updating, and deleting data.

Note
For all of the data-access examples in this chapter, you need the Adventure Works database titled AdventureWorks2012 Data File (SQL Server 2008) or AdventureWorksDW2012 Data File (SQL Server 2012). As of this writing, you can find this link at http://msftdbprodsamples.codeplex.com/releases/view/55330. You can then attach this database to your SQL Server 2012 Express instance using SQL Server Management Studio. This chapter was written using the SQL Server 2008 database file.

In addition, stored procedure SQL files required for the sample code can be found with the code download for this chapter.

Selecting Data

After the connection to the data source is open and ready to use, you probably want to read the data from it. If you do not want to manipulate the data but simply read it or transfer it from one spot to another, use the DataReader class (or one of the classes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required