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 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.