Your code retrieves a cached DataTable object that contains tourist attraction description and a
numeric country code named CountryID. The DataTable object is named attractionsTable.
You want to extract an array of DataRow objects from the DataTable object. You want to include
tourist attractions for only the selected county.
Which code segment should you use?
A. Dim result As DataRow() = _ attractionsTable.Select( _ "CountryID = " &
countryList.SelectedItem.Text)
B. Dim result As DataRow() = _ attractionsTable.Select( _ "CountryID = " &
countryList.SelectedItem.Value)
C. Dim result As DataRow = _ attractionsTable.Rows.Find( _ "CountryID = " &
countryList.SelectedItem.Value)
D. Dim result As DataRow = _ attractionsTable.Rows.Find( _ countryList.SelectedItem.Value)
Answer: B
Explanation:
The DataTable.Select method gets an array of all DataRow objects that match the filter criteria in
order of primary key (or lacking one, order of addition.). The filter will compare CountryID values.
We should use Country codes and not country names. We should therefore use the Value of the
selected item, not the Text.
Reference:
.NET Framework Class Library, DataTable.Select Method (String) [Visual Basic]
.NET Framework Class Library, ListControl.SelectedItem Property [Visual Basic]
Incorrect Answers

Exam Name:
Developing and Implementing Web Applications with Microsoft Visual Basic.NET
Exam Type:
Microsoft
Exam Code:
70-305
Total Questions:
212
Page 92 of 144
A:
The ListBox.TextBox property gets or searches for the text of the currently selected item in the
ListBox. However, this would retrieve names of countries, but the filter use comparison to a
CountryID column. We must use the country code, not the country name.
C, D:
The DataRowCollection.Find method is not appropriate in this scenario. It retrieves only a
single row, not an array of rows.
Question: 119.
You create an ASP.NET page that retrieves product information from a Microsoft SQL Server
database named XYZDB. You want to display the list of products in a Repeater control named
repeaterProducts. Your code uses the System.Data namespace and the System.Data.SqlClient
namespace.
You write the following procedure to retrieve the data:
Private Sub RepeaterBind( _
ByVal ConnectionString As String, _
ByVal SQL As String)
Dim da As SqlDataAdapter
Dim dt As DataTable
da = New SqlDataAdapter(SQL, ConnectionString)
dt = New DataTable()
You need to add code that will fill repeaterProducts with data retrieved from the database.
Which code segment should you use?
A. repeaterProducts.DataSource = dt repeaterProducts.DataBind() da.Fill(dt)
B. da.Fill(dt) repeaterProducts.DataBind() repeaterProducts.DataSource = dt
C. repeaterProducts.DataBind() da.Fill(dt) repeaterProducts.DataSource = dt
D. da.Fill(dt) repeaterProducts.DataSource = dt repeaterProducts.DataBind()
Answer: D
Explanation:
First we must fill the data set. Then we specify the data source, and finally we bind the data to the
control.


You've reached the end of your free preview.
Want to read all 144 pages?
- Spring '16
- .NET Framework, Microsoft SQL Server, Microsoft Visual Studio