Date post: | 16-Dec-2015 |
Category: |
Documents |
Upload: | eva-abbitt |
View: | 216 times |
Download: | 0 times |
PREVIEWING THE PARADISE BOOKSTORE APPLICATION Open the Paradise.exe file
Application displays records in the Books database
Allows the store manager to enter an author’s name (or part of a name) Displays only books written by the author
Displays the total value of books in the store
2
LESSON A OBJECTIVES
After studying Lesson A, you should be able to:
Define basic database terminology
Connect an application to a Microsoft Access database
Bind table and field objects to controls
Explain the purpose of the DataSet, BindingSource, TableAdapter, TableAdapterManager, and BindingNavigator objects
Customize a DataGridView control
Handle errors using the Try…Catch statement
Position the record pointer in a dataset
4
DATABASE TERMINOLOGY
Computer database Electronic file containing an organized collection of related
information
Relational database Database that stores information in tables composed of rows
and columns Each column in a table represents a field Each row in a table represents a record
Field Single piece of information about a person, place, or thing
5
DATABASE TERMINOLOGY (CONT’D.) Record
Group of related fields that contain all the necessary data about a specific person, place, or thing
Table: Group of related records Each record in a table pertains to the same topic and
contains the same type of information
Primary key: Field uniquely identifying a record
A two-table database has parent and child tables
Foreign key Field that links a child record to a parent record
6
DATABASE TERMINOLOGY (CONT’D.) Advantages of a relational database
Data can be retrieved quickly and easily Data can be displayed in any order You can control how much data to view
9
BINDING THE OBJECTS IN A DATASET Must bind one or more objects in the dataset to controls
in the interface to view dataset contents
Binding Connecting an object to a control
Bound controls Connected controls
Types of controls used to bind dataset objects Computer-created control Existing control on the form
10
HAVING THE COMPUTER CREATE A BOUND CONTROL (CONT’D.) In addition to a control, the computer adds:
BindingNavigator control: To move from one record to the next in the dataset
TableAdapter object: Connects the database to the DataSet object; responsible for retrieving data and storing it in the DataSet
TableAdapterManager object: Handles saving data to multiple tables in the DataSet
BindingSource object: Provides the connection between the DataSet and the bound controls
13
14
Figure 13-16 Illustration of the relationships among the database, the objects in the component tray, and the bound controls
THE DATAGRIDVIEW CONTROL DataGridView control
Displays data in a row and column format
Cell: Intersection of a row and column
DataGridView’s task list allows you to add, reorder, and remove columns and set properties of bound columns
AutoSizeColumnsMode: Has seven settings that control how the column widths are sized Fill setting: Automatically adjusts the column widths so that
the display area of the control is filled
15
21
BINDING TO AN EXISTING CONTROL Open the Morgan Industries Solution (Morgan Industries
Solution.sln) file contained in the VB2010\Chap13\Morgan Industries Solution-Labels folder
25
LESSON B
After studying Lesson B, you should be able to:
• Query a dataset using LINQ
• Customize a BindingNavigator control
• Use the LINQ aggregate operators
26
CREATING A QUERY
You use a query to specify both the records to select in a dataset and the order in which to arrange the records.
You can create a query in Visual Basic using a language feature called Language Integrated Query ( LINQ)
34
LESSON C
After studying Lesson C, you should be able to:
• Prevent the user from adding and deleting records
• Remove buttons from a BindingNavigator control
• Add a label, a text box, and a button to a BindingNavigator control