C H A P T E R  13

Executing ADO.NET Commands to Retrieve Data

Once you’ve established a connection to the database, you want to start interacting with it and getting it doing something useful for you. You may need to retrieve, add, update, or delete some data, or perhaps modify the database in some other way, usually by running a query. Whatever the task, it will inevitably involve a command.

In this chapter, we’ll explain commands, which are objects that encapsulate the T-SQL for the action you want to perform and that provide methods for submitting it to the database. Each data provider has a command class that implements the System.Data.IDbCommand interface.

In this chapter, we’ll cover the following:

  • Creating commands
  • Executing commands ...

Get Beginning C# 5.0 Databases, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.