20.7. Querying the Books Database

Now that you have seen how to display an entire database table in a DataGridView, we demonstrate how to execute specific SQL SELECT queries on a database and display the results. Although this example only queries the data, the application could be modified easily to execute other SQL statements. Perform the following steps to build the example application, which executes custom queries against the Titles table of the Books database.

Step 1.
Creating the Project First, create a new Windows Application named DisplayQueryResult. Rename the Form FrmDisplayQueryResult and name its source file FrmDisplayQueryResult.vb, then set the Form’s Text property to Display Query Result.
Step 2.
Adding a Data Source to the ...

Get Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition 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.