PrepAway - Latest Free Exam Questions & Answers

Category: 70-561

Exam 70-561: TS: Microsoft .NET Framework 3.5, ADO.NET Application Development

Which code segment should you use?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You write the following code segment.

DataTable tbl = new DataTable();
DataColumn colId = tbl.Columns.Add("ID", typeof(int));
colId.AutoIncrement = true;
tbl.Constraints.Add("Pkey", colId, true);
DataColumn colCtry = tbl.Columns.Add("Country", typeof(string));
colCtry.DefaultValue = "USA";
tbl.Columns.Add("Name", typeof(string));

You need to create a new row in the tbl DataTable that meets the following requirements:

The ID column is set to an auto-incremented value.
The Country column is set to the default value.
The Name column is set to the value "Customer A".

Which code segment should you use?

Which code segment should you use?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You write the following code segment.

DataTable tblInvDet = new DataTable("InvoiceDetail");
DataColumn colInvNo = tblInvDet.Columns.Add("InvNo", typeof(string));
DataColumn colItemNo = tblInvDet.Columns.Add("ItemNo", typeof(int));

You need to ensure that the corresponding values in the InvNo DataColumn and the ItemNo DataColumn form a unique pair.

Which code segment should you use?

Which code segment should you use?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You write the following code segment.

DataTable tblCustomer = new DataTable("Customer");
DataColumn parentCol= tblCustomer.Columns.Add("ID", typeof(int));
//Other columns added for tblCustomer
DataTable tblOrder = new DataTable("Order");
DataColumn childCol=tblOrder.Columns.Add("CustomerID",typeof(int));
//Other columns added for tblOrder
DataSet ds = new DataSet();
ds.Tables.Add(tblOrder);
ds.Tables.Add(tblCustomer);

The CustomerID column relates the Order DataTable to the Customer DataTable. You need to ensure that when you delete a row in the Customer DataTable, the corresponding row in the Order DataTable is deleted.

Which code segment should you use?

Which code segment should you use?

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 write the following code segment.

string sql = "Select InvoiceNo,OrderAmount from Orders";
SqlDataAdapter adp = new SqlDataAdapter(sql, con);
DataTable tblOrders = new DataTable();
adp.Fill(tblOrders);

If the value of the OrderAmount column is greater than 1000, then a discount of 5 percent is calculated.
You need to create a DataColumn object named Discount that contains the discount value for each row in the tblOrders DataTable.

Which code segment should you use?

Which code segment should you insert at line 13?

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 write the following code segment. (Line numbers are included for reference only.)

01 SqlConnection sqlconn
02 …
03 SqlDataAdapter ordAdapter =
04 new SqlDataAdapter(
05 SELECT OrderID, CustomerID, OrderDate, Qty, UnitPrice,"+
06 "UnitMargin FROM Sales.SalesOrderDetail", sqlconn);
07 DataSet ord_ds = new DataSet();
08 DataTable ord_dt = ord_ds.Tables.Add("Orders");
09 ordAdapter.Fill(ord_dt);
10 ord_dt.Rows[0].BeginEdit();
11 // The code here will insert, update and delete rows to the ord_dt DataTable.
12 ord_dt.Rows[0].EndEdit();
13
14 ord_dt.AcceptChanges();

You need to validate that every row that has the Qty column value is set to zero before you commit any changes.

Which code segment should you insert at line 13?

Which code segment should you add?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET.

You write the following code segment.

SqlConnection sqlconn;

SqlDataAdapter custAdapter = new SqlDataAdapter("SELECT CustID, CompanyName FROM Sales.Customer", sqlconn);
SqlDataAdapter ordAdapter = new SqlDataAdapter("SELECT OrderID, CustID, OrderDate FROM "+ "Sales.SalesOrderDetail", sqlconn);
DataSet customerOrders = new DataSet();
custAdapter.Fill(customerOrders, "Customers");
ordAdapter.Fill(customerOrders, "Orders");

You need to ensure that the output of the customerOrders DataSet matches the XML schema of the following code fragment.

<CustomerOrders>
<Customers>
<CustID>ALFKI</CustID>
<CompanyName>Alfreds Futterkiste</CompanyName>
</Customers>
<Orders>
<OrderID>10643</OrderID>
<CustID>ALFKI</CustID>
<OrderDate>1997-08-25T00:00:00</OrderDate>
</Orders>
<Orders>
<OrderID>10692</OrderID>
<CustID>ALFKI</CustID>
<OrderDate>1997-10-03T00:00:00</OrderDate>
</Orders>
</CustomerOrders>

Which code segment should you add?

Which line of code should you insert at line 14?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft Synchronization Services for Microsoft ADO.NET.

The application uses a Microsoft SQL Server 2005 (Compact Edition) database. This database contains a table named Order. Microsoft Windows Mobilebased devices synchronize data concurrently with the database server.

You write the following code segment. (Line numbers are included for reference only.)

01 public class ServerSyncProvider : DbServerSyncProvider
02 {
03 public ServerSyncProvider()
04 {
05 SyncAdapter orderSyncAdapter =
06 new SyncAdapter("Order");
07 SqlCommand ManageRows = new SqlCommand();
08 ManageRows.CommandText =
09 "DELETE FROM dbo.Order WHERE OrderId = @OrderId " +
10 "AND ((UpdateTS <= @sync_last_received_anchor OR " +
11 "UpdateId = @sync_client_id ) OR @sync_force_write=1) " +
12 "IF (@@rowcount > 0) UPDATE Sales. Order_Tombstone SET "+
13 "DeleteId = @sync_client_id WHERE OrderId = @OrderId";
14
15 }
16 }

You need to ensure that the application performs the following tasks:

It allows bidirectional incremental data changes to the Order table.
It generates the ClientUpdateServerDelete action as a conflict.

Which line of code should you insert at line 14?

Which code segment should you add?

You create a Microsoft Windowsbased application by using the Microsoft .NET Framework 3.5 andnMicrosoft Synchronization Services for Microsoft ADO.NET. The application uses a Microsoft SQL Server 2005 database.

To synchronize data, the application connects to a table named Leads that contains a column named State.
You write the following code segment.

SqlConnection cn = new SqlConnection("SERVER=myServer;DATABASE=CRMDb;");
SqlSyncAdapterBuilder bldr = new SqlSyncAdapterBuilder(cn);

You need to ensure that the application partitions the data horizontally.

Which code segment should you add?

Which two code segments should you add?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft Synchronization Services for Microsoft ADO.NET.

The application uses a database that contains two tables named Orders and OrderDetails. A primary key to foreign key relationship exists between these two tables.
You write the following code segment.

SyncTable tableOrders = new SyncTable("Orders");
SyncTable tableOrderDetails = new SyncTable("OrderDetails");
SyncGroup orderGroup = new SyncGroup("Changes");

You need to ensure that the following requirements are met:

Updates are synchronized to both the tables.
Referential integrity is accounted for.

Which two code segments should you add? (Each correct answer presents part of the solution. Choose two.)

Which line of code should you insert at line 06?

You are creating a Microsoft Windows Mobilebased application by using the Microsoft .NET Framework 3.5 and Microsoft Synchronization Services for Microsoft ADO.NET.

You write the following code segment. (Line numbers are included for reference only.)

01 private void Init()
02 {
03 SyncConflictResolver scr = new SyncConflictResolver();
04 scr.ClientUpdateServerUpdateAction = ResolveAction.FireEvent;
05 SqlCeClientSyncProvider csp = new SqlCeClientSyncProvider();
06
07 }

You need to ensure that the application handles synchronization conflicts when data is updated in the database of the application.

Which line of code should you insert at line 06?


Page 5 of 8« First...34567...Last »