Chapter 4
Querying Your Database
In Chapter 3, you learned how to connect to a database using the Microsoft ADO.NET Connection object. Now it's time to learn how to execute queries against your database. In the ADO.NET object model, you execute queries using the Command object.
In this chapter, I'll first focus on specific tasks you'll want to perform that involve the Command object. Along the way, I'll also introduce two other ADO.NET objects: the DataReader and Parameter objects. (DataReader objects allow you to examine the results of your queries, and Parameter objects allow you to execute parameterized queries.) Then I'll explain how you can create Command objects quickly and easily using features of the Microsoft Visual Studio .NET development environment. Finally, we'll examine the properties, methods, and events of the Command, DataReader, and Parameter objects.