1.
A Windows Forms application contains the following code segment.
Dim SQL As String = "SELECT EmployeeID, LastName, FirstName FROM Employees" Dim da As New
SqlDataAdapter(SQL, connStr)
Dim dt As New DataTable()
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
Dim bld As New SqlCommandBuilder(da)
da.Fill(dt)
The application allows the user to add rows to the data table. The application will propagate these additions to the database. If the addition of any row fails, the other rows must still be added. The code must log how many new rows failed to be added. You need to propagate the additions to the database and log a failed count. Which code segment should you use?
2.
A Windows Forms application loads an XmlDocument from a file named books.xml. You need to validate the XML against a schema that is contained in the books.xsd file when the XML loads. What should you do?
3.
You are creating a Windows Forms application that implements a master/detail form by using two DataGridView controls. You populate a dataset with a master table and a details table. You set the DataSource property of the master DataGridView control to the dataset. You set the DataMember property to the name of the master table. You also set the DataSource property of the details DataGridView control to the dataset. You need to ensure that the details DataGridView control displays only the child rows of the selected master row. What should you do?
4.
You are creating a Windows Forms application to retrieve and modify data. Depending on the installation, the data source can be a Microsoft Access database or a Microsoft SQL Server 2000 or later database. You need to ensure that your application accesses data by automatically using the data provider that is optimized for the data source. What should you do?
5.
You are creating a Windows Forms application. The application uses a SqlCommand object named cmd. The cmd object executes the following stored procedure.
CREATE PROCEDURE GetPhoneList
AS
BEGIN
SELECT CompanyName, Phone FROM Customers
SELECT CompanyName, Phone FROM Suppliers
END
You need to add all returned rows to the ListBox control named lstPhones. Which code segment should you use?
6.
A Windows Forms application contains the following code segment.
Dim SQL As String = "SELECT OrderID, ProductID, UnitPrice, Quantity FROM [Order Details]" Dim da As New
SqlDataAdapter(SQL, connStr)
Dim dt As New DataTable()
da.Fill(dt)
You need to add a new column to the data table named ItemSubtotal. The ItemSubtotal column must contain the value of the UnitPrice column multiplied by the value of the Quantity column. Which code segment should you use?
7.
You are creating a Windows Forms application. Initialization code loads a DataSet object named ds that includes a table named Users. The Users table includes a column named IsManager. You need to bind the IsManager column to the Checked property of a check box named chkIsManager. Which code segment should you use?
8.
You are creating a Windows Forms application that includes the database helper methods UpdateOrder and UpdateAccount. Each method wraps code that connects to a Microsoft SQL Server 2005 database, executes a Transact-SQL statement, and then disconnects from the database. You must ensure that changes to the database that result from the UpdateAccount method are committed only if the UpdateOrder method succeeds. You need to execute the UpdateAccount method and the UpdateOrder method. Which code segment should you use?
9.
You are creating a Windows Forms application. The application executes a stored procedure that takes several seconds to complete. The stored procedure is invoked to populate a SqlDataReader object. You need to ensure that the application remains responsive to the user while the stored procedure is executing. What should you do?
10.
You create a personalized home page. You want to enable users to choose from a selection of daily headlines from different news providers. You create a series of custom user controls. Each control points to a different news provider. You need to add these controls to the personalized home page. What should you do?