Download presentation
Presentation is loading. Please wait.
Published byEva Abbitt Modified over 9 years ago
2
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
3
3 Figure 13-1 Books written by Carol Smith
4
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
5
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
6
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
7
7 Figure 13-3 Example of a one-table relational database
8
8 Figure 13-4 Example of a two-table relational database
9
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
10
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
11
11 Figure 13-11 Ways to bind an object in a dataset
12
12 Figure 13-15 Result of dragging the table object to the form
13
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
14 Figure 13-16 Illustration of the relationships among the database, the objects in the component tray, and the bound controls
15
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
16
16 Figure 13-17 DataGridView control’s task list
17
17 Figure 13-18 Purpose of each task in the DataGridView’s task list
18
18 Figure 13-19 Edit Columns dialog box
19
19 Figure 13-20 Completed CellStyle Builder dialog box
20
20 Figure 13-21 DataGridView control after setting some of its properties
21
Open the Morgan Industries Solution (Morgan Industries Solution.sln) file contained in the VB2010\Chap13\Morgan Industries Solution-Labels folder 21
22
ทำการเชื่อมต่อฐานข้อมูลด้วย Data Source Configuration Wizard 22
23
23
24
24
25
After studying Lesson B, you should be able to: Query a dataset using LINQ Customize a BindingNavigator control Use the LINQ aggregate operators 25
26
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) 26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
34
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 34
35
35
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.