Executing Commands Against a Data Store

Once you’ve connected to a data store, you can execute commands against it. In this section, we’ll look at how you can build command objects and execute these against a connection. Specifically, we’ll look at how to invoke commands that return the following:

  • A single value, such as an aggregate value

  • A read-only data reader

  • An updatable, scrollable DataSet

Building Commands

The IDbCommand interface defines the functionality of a command class. Its two implementations, SqlCommand and OleDbCommand, expose the same properties and methods, with the exception that SqlCommand provides support for reading XML. (We’ll discuss this functionality later in this chapter). However, you use all command objects in the same ...

Get Microsoft® Visual J#™ .NET (Core Reference) 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.