O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

22.6. Dynamically Binding Query Results

Now that you’ve seen how to display an entire database table in a DataGridView, we show how to perform several different queries and display the results in a DataGridView. This app only reads data from the entity data model, so we disabled the buttons in the BindingNavigator that enable the user to add and delete records. Later, we’ll explain why we do not support modifying the database in this example.

The Display Query Results app (Fig. 22.21) allows the user to select a query from the ComboBox at the bottom of the window, then displays the results of the query.

a) Results of the “All titles” query, which shows the contents of the Titles table ordered by the book titles

b) Results of the “Titles with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required