1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 20 - Data Presentation Using the DataGrid Control

By , About.com Guide

8 of 10

The View of the Students Database

Checking Server Explorer, we see that a View has been defined against the database called Cumulative Class Percentiles. A View is essentially a dynamically generated "result" table that is put together based upon the parameters you have defined in a query. You can see the view in Access by displaying a query by the same name. The query uses information from three different tables in a calculation that is part of the query and is saved in the Students database.

To create this new DataGrid, follow essentially the same steps in the book with a second DataGrid object in the same form. This time, try using the Cumulative Class Percentiles view rather than the Instructors table.

You can use the same OleDbConnection1 connection object, but since the Data Adapter includes the SQL statement that defines the data to be used, you will have to add a new OleDbDataAdapter. This pops up a wizard to help you again.

In addition to the new View, try clicking the Query Builder button when the book tells you to type a Select statement instead. Select the Views tab and the Cumulative Class Percentiles view. Cick the Add and then the Close button in the window that pops up next. Then select each of the columns. This gives you the Select statement shown below with a lot less effort than working out the SQL for yourself.

~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT
  ClassID,
  [Grade (%)],
  StudentID
FROM
  [Cumulative Class Percentiles]
~~~~~~~~~~~~~~~~~~~~~~~~~

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Data Presentation Using the DataGrid Control

©2009 About.com, a part of The New York Times Company.

All rights reserved.