Professional Documents
Culture Documents
TIF Crews Ch11
TIF Crews Ch11
NET
CHAPTER 11
6. The primary and foreign keys identify the relationship between tables.
Answer: True Level: Moderate
Section: 11-1 Page: 287
8. The primary and foreign keys are the only fields in most tables.
Answer: False Level: Moderate
Section: 11-1 Page: 287
11 - 1
Chapter 11 Databases and ADO.NET
11. Information is retrieved from the database using the Structured Query Language.
Answer: True Level: Easy
Section: 11-2 Page: 290
12. The SELECT clause of an SQL query specifies which fields are retrieved.
Answer: True Level: Easy
Section: 11-2 Page: 290
13. The FROM clause of an SQL query specifies which rows are retrieved.
Answer: False Level: Easy
Section: 11-2 Page: 290
14. The # symbol in an SQL query is a wildcard, which retrieves all fields in a table.
Answer: False Level: Easy
Section: 11-2 Page: 290
15. Square brackets [ ] must surround any database field name that has a space in it.
Answer: True Level: Moderate
Section: 11-2 Page: 290
16. The WHERE clause must have criteria for restricting a subset of the data.
Answer: True Level: Easy
Section: 11-2 Page: 291
17. The four relational operators allowed in the WHERE clause are >, <, =, and <>.
Answer: False Level: Easy
Section: 11-2 Page: 291
18. The WHERE clause is not often used in the daily retrieval of information from a database.
Answer: False Level: Moderate
Section: 11-2 Page: 291
19. The default for the ORDER BY clause of an SQL query is descending.
Answer: False Level: Easy
Section: 11-2 Page: 292
21. The JOIN clause of an SQL query is used to get related data from two tables.
Answer: True Level: Easy
Section: 11-2 Page: 292
22. The default for a JOIN clause is the INNER JOIN type.
Answer: True Level: Moderate
Section: 11-2 Page: 293
11 - 2
Chapter 11 Databases and ADO.NET
23. The DBMS will automatically determine the primary and foreign key fields to use in a JOIN
statement.
Answer: False Level: Hard
Section: 11-2 Page: 293
24. ADO.NET uses three objects to access a database: Command, DataAdapter, and Dataset.
Answer: False Level: Moderate
Section: 11-3 Page: 294
25. The OleDbConnection ADO.NET object is used to create a connection to an Access database.
Answer: True Level: Easy
Section: 11-3 Page: 294
26. An OleDbConnection ADO.NET object added from the Toolbox is displayed on the Form.
Answer: False Level: Easy
Section: 11-3 Page: 295
27. The ConnectionString property of the OleDbConnection object must be set before your VB.NET
program can access a database.
Answer: True Level: Moderate
Section: 11-3 Page: 295
28. The DataAdapter object can be created prior to the OleDbConnection object.
Answer: False Level: Moderate
Section: 11-3 Page: 297
29. The DataAdapter object acts as translator between the VB.NET program and the database.
Answer: True Level: Easy
Section: 11-3 Page: 297
30. The SQL query sent to the database can be typed in or created graphically.
Answer: True Level: Moderate
Section: 11-3 Page: 299
31. A Configuration Wizard can be used to help the developer configure the DataAdapter Object.
Answer: True Level: Easy
Section: 11-3 Page: 298
34. A Dataset is a reference to the database and the data is not actually stored on the local computer.
Answer: False Level: Moderate
Section: 11-3 Page: 300
11 - 3
Chapter 11 Databases and ADO.NET
35. The information in a Dataset can automatically be displayed if a data-aware control is bound to it.
Answer: True Level: Easy
Section: 11-4 Page: 302
36. The DataBinding property of a data-aware control identifies the field to be displayed.
Answer: False Level: Moderate
Section: 11-4 Page: 302
37. The data-aware control gets the field to display from the DataAdapter Object.
Answer: False Level: Easy
Section: 11-4 Page: 302
38. The fill method must be placed in the Form Load event.
Answer: False Level: Easy
Section: 11-4 Page: 303
39. The Clear method of a Dataset should be called before using the Fill method of a DataAdapter.
Answer: True Level: Moderate
Section: 11-4 Page: 303
40. The count property is one more than the position of the last record.
Answer: True Level: Moderate
Section: 11-4 Page: 303
41. The BindingContext position property can be read while the program is running but it cannot be
changed with an assignment statement.
Answer: False Level: Moderate
Section: 11-4 Page: 303
42. To display ADO.NET data in a DataGrid you must set the DataGrid properties at design time.
Answer: False Level: Moderate
Section: 11-5 Page: 305
43. The DataMember property of a DataGrid contains the name of the Dataset object.
Answer: False Level: Moderate
Section: 11-5 Page: 305
44. Both the DataMember and DataSource properties need to be specified for the DataGrid to work.
Answer: True Level: Moderate
Section: 11-5 Page: 305
45. One form can contain multiple DataAdapters, which use the same Connection object.
Answer: True Level: Moderate
Section: 11-5 Page: 305
11 - 4
Chapter 11 Databases and ADO.NET
11 - 5
Chapter 11 Databases and ADO.NET
53. Which clause is required in an SQL query for getting information from a database?
a.) JOIN
b.) ON
c.) ORDER BY
d.) SELECT
e.) WHERE
11 - 6
Chapter 11 Databases and ADO.NET
56. Which is the wildcard symbol for selecting all the fields in a table?
a.) @
b.) #
c.) ^
d.) *
e.) +
57. The WHERE clause is used to restrict the number of ____ retrieved by an SQL statement.
a.) fields
b.) records
c.) tables
d.) Both a and b.
e.) All of the above.
11 - 7
Chapter 11 Databases and ADO.NET
61. Which property of the database must the connection object contain?
a.) Location
b.) Type
c.) Query
d.) Both a and b.
e.) All of the above.
63. What information is specified in the Connection tab of the DataLink window?
a.) Database login
b.) Database name
c.) Database type
d.) Both a and b.
e.) All of the above.
11 - 8
Chapter 11 Databases and ADO.NET
65. Which DataAdapter Query Type can be used with the Access database?
a.) Use SQL statements.
b.) Create new stored procedure.
c.) Use existing stored procedure.
d.) Both a and b.
e.) All of the above.
11 - 9
Chapter 11 Databases and ADO.NET
71. What is the proper code to put data into the dataset called CustomerDataset using the
CustomerDataAdapter object?
a.) CustomerDataset.Fill(CustomerDataAdapter)
b.) CustomerDataAdapter.Fill(CustomerDataset)
c.) CustomerDataset.Load(CustomerDataAdapter)
d.) CustomerDataAdapter.Load(CustomerDataset)
e.) None of the above.
72. Which object contains the Position property of the current record in a dataset?
a.) BindingContext
b.) BindingData
c.) DataBinding
d.) DataBound
e.) DataContext
11 - 10
Chapter 11 Databases and ADO.NET
80. Foreign key related to primary keys are found in ___different___ tables.
Level: Hard
Section: 11-1 Page: 287
82. A ___linking__ table is used to identify the many-to-many relationship of two tables.
Level: Hard
Section: 11-1 Page: 289
11 - 11
Chapter 11 Databases and ADO.NET
83. A ___Database Management System (DBMS)___ is used to create and modify databases, as well
as get data into and out of the database.
Level: Moderate
Section: 11-1 Page: 288
84. First, Second, and Third normal forms are all stages of the ___normalization___ process.
Level: Moderate
Section: 11-1 Page: 289
85. The ___Structured Query Language (SQL)___ is a standard language used to retrieve data from a
database.
Level: Moderate
Section: 11-2 Page: 290
86. The ___asterisk *___ is used as a wildcard that returns all of the fields in a table.
Level: Easy
Section: 11-2 Page: 290
87. The SELECT clause determines which ___fields___ will be retrieved from the database.
Level: Easy
Section: 11-2 Page: 290
88. The ___LIKE___ operator is used in the WHERE clause to match patterns of characters.
Level: Moderate
Section: 11-2 Page: 292
89. The ORDER BY clause uses the ___ASC___ keyword sort data in ascending order and the
___DESC___ keyword to sort data in descending order.
Level: Moderate
Section: 11-2 Page: 292
90. The JOIN clause requires both ___tables___ and ___columns (fields)___ to be specified in the
query.
Level: Hard
Section: 11-2 Page: 293
91. The three types of ADO.NET objects required for exchanging data between a database and
VB.NET program are the ___Connnection___, ___DataAdapter___, and ___Dataset___ objects.
Level: Easy
Section: 11-3 Page: 294
92. The term OLE stands for ___object linking and embedding___.
Level: Hard
Section: 11-3 Page: 294
93. The ___connection string___ property of the OleDbConnection object contains the location of the
database being accessed.
Level: Moderate
Section: 11-3 Page: 295
11 - 12
Chapter 11 Databases and ADO.NET
94. The Microsoft Jet 4.0 OLE Provider is used when connecting to a(n) ___Access___ database.
Level: Moderate
Section: 11-3 Page: 296
95. The ___DataAdapter___ Wizard can be used to configure the OleDbDataAdapter object.
Level: Easy
Section: 11-3 Page: 298
96. The ___SQLDataAdapter___ object is used when connected to Microsoft SQL Server.
Level: Moderate
Section: 11-3 Page: 299
97. The ___Query Builder___ button makes it easy create the SQL query associated with a
DataAdapter.
Level: Moderate
Section: 11-3 Page: 299
98. The ___Dataset___ object holds the data generated by the SQL query in the DataAdapter.
Level: Easy
Section: 11-3 Page: 300
101. The ___data-aware___ control will automatically display data from the bound dataset.
Level: Easy
Section: 11-4 Page: 302
102. The ___DataBound___ property holds the name of the field and dataset bound to the control.
Level: Moderate
Section: 11-4 Page: 302
104. The ___BindingContext___ object monitors information about all data sources in a form.
Level: Moderate
Section: 11-4 Page: 303
11 - 13
Chapter 11 Databases and ADO.NET
106. The DataGrid control uses the ___DataSource___ property to identify the source of the data
being displayed.
Level: Easy
Section: 11-5 Page: 305
107. The DataGrid control uses the ___DataMember___ property when more than one bindable
element exists.
Level: Moderate
Section: 11-5 Page: 305
Essay Questions
108. Describe the function and syntax of each part of an SQL SELECT statement, including the
ORDER BY and WHERE clauses?
The SELECT query has two mandatory elements: SELECT and FROM.
SELECT specifies which fields (or columns) will be returned from the database. Using an asterisk
will return all fields in a table.
FROM identifies the tables which contain the fields listed in the SELECT clause. Fields from
separate tables that have the same name must be qualified with the name of the table they come
from.
The ORDER BY clause is optional. If a field from the SELECT clause is placed after the ORDER
BY the rows of data are sorted in ascending order based on that field. The keywords ASC or
DESC can be placed after the field name to explicitly specify the order the data will be sorted in.
The WHERE clause is used to restrict which records are returned from the database. The criteria
for inclusion, based on a logical test (=, <>, >, <, >=, <=) of one or more fields, is placed after
the keyword WHERE. The criteria can also include the LIKE operator, which will compare the
field to a literal string mask which includes wild card symbols for a single character (?) or
multiple characters (*).
109. Define the functions of the ADO.NET Connection, DataAdapter, and Dataset objects. Indicate
the naming convention for each type.
The Connection Object establishes a link to the database by specifying the physical location (i.e.
Network Directory), the type of database being accessed, and even the password information in
the Connection String property. This is analogous to having the phone number and a working
phone line for contacting a person who has information you need.
The DataAdapter object acts as a mediator which translates the language of VB.Net into the
unique language of the databases and vice-versa. The DataAdapter takes the SQL query and
translates it into a version the database understands. The DataAdapter also takes the output of
11 - 14
Chapter 11 Databases and ADO.NET
the database and translates it into a version that the VB.NET program can use. This output
created by the DataAdapter is the Dataset Object.
The Dataset object is a local copy of the information requested by the SQL query. VB.NET can
then easily display this data in data-aware controls. Because this is local data any changes in
the original data in the database will not be reflected in the program (the local data is
disconnected from the database).
The prefix for the Connection, DataAdapter, and Dataset objects are cn, da, and ds respectively.
11 - 15