Exercises

  1. 22.3 (Display Authors Table App Modification) Modify the app in Section 22.5 to contain a TextBox and a Button that allow the user to search for specific authors by last name. Include a Label to identify the TextBox. Using the techniques presented in Section 22.9, create a LINQ query and change the DataSource property of authorBindingSource to contain only the specified authors. Also, provide a Button that enables the user to return to browsing the complete set of authors.

  2. 22.4 (Display Query Results App Modification) Modify the app in Section 22.6 to contain a TextBox and a Button that allow the user to perform a search of the book titles in the Titles table of the Books database. Use a Label to identify the TextBox. When the user clicks the Button, the app should execute and display the result of a query that selects all the rows in which the search term entered by the user in the TextBox appears anywhere in the Title column. For example, if the user enters the search term “Visual,” the DataGridView should display the rows for Visual Basic 2012 How to Program and Visual C# How to Program. If the user enters “Swift,” the DataGridView should display only the rows for iOS 8 for Programmers: An App-Driven Approach with Swift and Swift for Programmers. [Hint: Use the Contains method of the String class.] Also, provide a Button that enables the user to return to browsing the complete set of titles.

  3. 22.5 (Joining Tables with LINQ App Modification) Create an app like the one in Section 22.7 that uses the Books database and displays the results of the following queries:

    1. Get a list of all the titles and the authors who wrote them. Sort the results by title.

    2. Get a list of all the titles and the authors who wrote them. Sort the results by title. For each title sort the authors alphabetically by last name, then first name.

    3. Get a list of all the authors grouped by title, sorted by title; for a given title sort the author names alphabetically by last name then first name.

  4. 22.6 (Baseball Database App) Build an app that executes a query against the Players table of the Baseball database included in the Databases folder with this chapter’s examples. Display the table in a DataGridView, and add a TextBox and Button to allow the user to search for a specific player by last name. Use a Label to identify the TextBox. Clicking the Button should execute the appropriate query. Also, provide a Button that enables the user to return to browsing the complete set of players.

  5. 22.7 (Baseball Database App Modification) Modify Exercise 22.6 to allow the user to locate players with batting averages in a specific range. Add a minimumTextBox for the minimum batting average (0.000 by default) and a maximumTextBox for the maximum batting average (1.000 by default). Use a Label to identify each TextBox. Add a Button for executing a query that selects rows from the Players table in which the BattingAverage column is greater than or equal to the specified minimum value and less than or equal to the specified maximum value.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset