In this Example, we will see packing more than one SQL statement in a SqlCommand and process it through the SqlDataReader object. From the past articles on ado.net we are already familiar with Connection, Command and Reader objects. Hence, we will focus on dealing with multiple result sets.
The example retrieves the data from the SQL Server sample database Pubs. A total number of authors queried from the table authors is displayed in a label control marked as 1 and author name from the same table is displayed in the combo box item marked as 2. The list box marked as 3 displays all store names by querying the table stores from the Pubs database. When we click the Get Data button (Marked as 4), the example fetches all the data through a single SqlCommand formed by three SQL statements.Read More