should you insert at line 05?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application connects to a Microsoft SQL Server 2005 database. The
application uses the following stored procedure. CREATE PROCEDURE
[dbo].[UpdateShippers]
@CountryCode NVarchar(10)
,@NewRateCode int
AS BEGIN
Update dbo.Shippers
SET RateCode = @NewRateCode Where CountryCode = @CountryCode RETURN
@@ROWCOUNT
END
You write the following code segment. (Line numbers are included for reference only.)
01 using (SqlConnection connection = new
SqlConnection(connectionString))
02 {
03 connection.Open();
04 SqlCommand command = new
SqlCommand(“UpdateShippers”, connection);
05
06 command.ExecuteNonQuery();
07 }
You need to ensure that the application can update the Shippers table. Which code segment
should you insert at line 05?
Which code segment should you insert at line 08?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application connects to a Microsoft SQL Server 2005 database.You create a
DataSet named northwind. The northwind DataSet contains two related tables named
Customers and Orders.You write the following code segment. (Line numbers are included
for reference only.)
01 private void Page_Load(object sender, EventArgs e)
02 {
03 this.ordTblAdap.Fill(this.northwind.Orders);
04 this.custTblAdap.Fill(this.northwind.Customers);
05 }
06 private void custBindNavSaveItem_Click(object sender, EventArgs e)
07 {
08
09 }
The two tables in the northwind DataSet are updated frequently.
You need to ensure that the application commits all the updates to the two tables before it
saves the data to the database.Which code segment should you insert at line 08?
Which code segment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5. The application consumes a Microsoft Windows Communication Foundation
(WCF) service.The WCF service exposes the following method.
[WebInvoke]
string UpdateCustomerDetails(string custID);
The application hosts the WCF service by using the following code segment.
WebServiceHost host = new WebServiceHost(typeof(CService), new Uri(“http://win/”));
ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ICService), new WebHttpBinding(),
“”);
You need to invoke the UpdateCustomerDetails method. Which code segment should you use?
Which code segment should you add?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.The application uses a Microsoft SQL Server 2005 database that contains a
Products table and an Inventory table.The application coordinates updates between the
records in the Products table and Inventory table by loading a DataSet class named DataSet1.
You write the following code segment.
DataColumn parentColumn = DataSet1.Tables[“Products”].Columns[“ProductID”];
DataColumn childColumn = DataSet1.Tables[“Inventory”].Columns[“ProductID”];
You need to ensure that the following requirements are met when the ProductID value is
modified in the Products table:
The ProductID value is unique.
The records in the Inventory table are updated with the new ProductID value.
Which code segment should you add?
Which code segment should you insert at line 06?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You write the following code segment in the code-behind file to create a Web
form. (Line numbers are included for reference only.)
01 string strQuery = “select * from Products;”
02 + “select * from Categories”;
03 SqlCommand cmd = new SqlCommand(strQuery, cnn);
04 cnn.Open();
05 SqlDataReader rdr = cmd.ExecuteReader();
06
07 rdr.Close();
08 cnn.Close();
You need to ensure that the gvProducts and gvCategories GridView controls display the data
that is contained in the following two database tables:
The Products database table
The Categories database table
Which code segment should you insert at line 06?
Which code segment should you insert at line 04?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET. The application uses a Microsoft SQL Server 2005 database. The application
contains a DataSet object that contains two DataTable objects. The DataTable objects
reference the Customers and Orders tables in the database. You write the following code
segment. (Line numbers are included for reference only.)
01 DataSet custOrderDS = new DataSet();
02 custOrderDS.EnforceConstraints = true;
03 ForeignKeyConstraint custOrderFK =
new ForeignKeyConstraint(“CustOrderFK”,
custOrderDS.Tables[“Customers”].Columns[“CustomerID”],
custOrderDS.Tables[“Orders”].Columns[“CustomerID”]);
04
05 custOrderDS.Tables[“Orders”].Constraints.Add(custOrderFK);
You need to ensure that an exception is thrown when you attempt to delete Customer
records that have related Order records.Which code segment should you insert at line 04?
Which code segment should you insert at line 04?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You add a Web form that contains the following code fragment.
<asp:GridView ID=”gvProducts” runat=”server” AllowSorting=”True”
DataSourceID=”Products”>
</asp:GridView>
<asp:ObjectDataSource ID=”Products” runat=”server” SelectMethod=”GetData”
TypeName=”DAL” />
</asp:ObjectDataSource>
You write the following code segment for the GetData method of the DAL class. (Line
numbers are included for reference only.)
01 public object GetData() {
02 SqlConnection cnn = new SqlConnection();
03 string strQuery = “SELECT * FROM Products”;
04
05 }
You need to ensure that the user can use the sorting functionality of the gvProducts
GridView control.Which code segment should you insert at line 04?
Which code segment should you insert at line 05?
You create an application by using the Microsoft .NET Framework 3.5 and Microsoft
ADO.NET.You write the following code segment. (Line numbers are included for reference
only.)
01 private void Update (SqlCommand cmdA, SqlCommand cmdB)
02 {
03 using (TransactionScope scope = new TransactionScope())
04 {
05
06 }
07 }
You need to execute the SqlCommand objects named cmdA and cmdB within a single
distributed transaction.Which code segment should you insert at line 05?
Which code segment should you use?
You are creating a Windows Forms application by using the .NET Framework 3.5. You have
implemented the PrintPage event to send the page output to the printer. The users must select
the printer and the page range before printing.You need to ensure that users can print the
content of the form by clicking the button control.Which code segment should you use?
Which code segment should you use?
You are creating a Windows Forms application that has the print functionality by using the
.NET Framework 3.5.You implement the PrintPage page event for the form. You associate
an instance of the PrintDocument control along with an instance of the PrintPreviewDialog
control named prevDialog1. You want to set the default size of the PrintPreviewDialog class
to full screen.You need to provide a print preview for the user by adding a code segment to
the Click event of the button on the form.Which code segment should you use?