PrepAway - Latest Free Exam Questions & Answers

Category: 70-561

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

What should you do to display the tables simultaneously by using a single SqlConnection object?

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 database contains two tables that are displayed in two different GridView controls. The tables are displayed by using two SqlConnection objects.
You need to display the tables simultaneously by using a single SqlConnection object.

What should you do?

What should you do to ensure that all valid records are retrieved even if invalid records are present?

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 GetRecords(SqlDataAdapter da, DataTable table) {
02
03 try {
04 da.Fill(table);
05 }
06 catch (SqlException exp) {
07
08 }
09 finally {
10
11 }
12 }

The da.SelectCommand.CommandText property is set to a stored procedure. The stored procedure declares a variable named @msg.

For each record that contains a bad shipping address, the stored procedure performs the following tasks:

It sets @msg with the id of the record.
It raises an error for the record.

The error raised is as shown in the following text: RaiseError(@msg, 10, 1)

You need to ensure that all valid records are retrieved even if invalid records are present. You also need to ensure that a list item is added to the lstResults list box for each invalid record.

What should you do?

What should you do to ensure that only 10 new records are downloaded?

You create a Microsoft Windows Mobilebased 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 caches data from the database server.
You write the following code segment. (Line numbers are included for reference only.)

01 public class MySyncProvider : DbServerSyncProvider{
02 public MySyncProvider (){
03 SqlConnection serverConn = new SqlConnection("SERVER = .; Database = pubs; uid = sa;");
04 this.Connection = serverConn;
05
06 this.BatchSize = 10;
07 }
08
09 }

You need to ensure that only 10 new records are downloaded whenever the application synchronizes.

What should you do?

What should you do to ensure that the method is successfully executed?

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 DDL statement.

CREATE TABLE [dbo].[tblTest](
[C1] [int] IDENTITY(1,1) NOT NULL,
[C2] [char](4) NULL,
[C3] NUMERIC(1,1) NOT NULL,
[C4] AS (C1*C3)
) ON [PRIMARY]

The application contains a method named update. The update method uses the following code segment.

SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM tblTest",sc);
da.UpdateCommand = new SqlCommand("UPDATE tblTest SET C2 = @C2, c3 = @C3, C4 = @C4 WHERE C1 = @C1", sc);

da.UpdateCommand.Parameters.Add("@C1", SqlDbType.Int, 4, "C1");

SqlParameter prm1 = new SqlParameter("@C2", SqlDbType.Char, 4);
prm1.SourceColumn = "C2";
da.UpdateCommand.Parameters.Add(prm1);

SqlParameter prm2 = new SqlParameter("@C3", SqlDbType.Decimal,4);
prm2.SourceColumn = "C3";
da.UpdateCommand.Parameters.Add(prm2);

SqlParameter prm3 = new SqlParameter("@C4", SqlDbType.Char, 4);
prm3.SourceColumn = "C4";
da.UpdateCommand.Parameters.Add(prm3);

When you execute the method, a SqlException exception is thrown.You need to ensure that the method is successfully executed.

What should you do?

What should you do to ensure that the application updates only records without optimistic concurrency violatio

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 that contains a table named Customers. Concurrent users update the Customers table frequently.
You write the following code segment. (Line numbers are included for reference only.)

01 SqlDataAdapter adapter = new SqlDataAdapter("SELECT CustomerID, CompanyName, LastUpdated" + " FROM Customers ORDER BY CustomerID", connection);
02 adapter.UpdateCommand = new SqlCommand("UPDATE Customers Set CompanyName = @CompanyName" + " WHERE CustomerID = @CustomerID AND " + "LastUpdated = @LastUpdated", connection);
03 adapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int, 0, "CustomerID");
04 adapter.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 30, "CompanyName");
05 SqlParameter parameter = adapter.UpdateCommand.Parameters.Add("@LastUpdated", SqlDbType.Timestamp, 0, "LastUpdated");
06 parameter.SourceVersion = DataRowVersion.Original;
07

You need to ensure that the application updates only records without optimistic concurrency violations.

What should you do?

What should you do to ensure that the application continues to execute while cmd is executing?

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 connection string of the application is defined in the following manner.

"Server=Prod;Database=WingtipToys;Integrated Security=SSPI;Asynchronous Processing=true"

The application contains the following code segment. (Line numbers are included for reference only.)

01 protected void UpdateData(SqlCommand cmd) {
02 cmd.Connection.Open();
03
04 lblResult.Text = "Updating …";
05 }

The cmd object takes a long time to execute. You need to ensure that the application continues to execute while cmd is executing.

What should you do?

Which entity SQL query should you use?

You create an application by using Microsoft .NET Framework 3.5. You use Microsoft ADO.NET Entity Framework for persistence.

You write a conceptual schema definition for the entity data model in the following manner.

<EntityType Name="Customer">
<Key>
<PropertyRef Name="CustomerID" />
</Key>
<Property Name="CustomerID" Type="Int32" Nullable="false" />
</EntityType>
<EntityType Name="Order">
<Property Name="InvoiceNo" Type="String" MaxLength="10" FixedLength="true" />
<NavigationProperty Name="Customer" Relationship="ContosoModel.FK_Customer_Order" FromRole="Order" ToRole="Customer" />
</EntityType>

You need to retrieve all the InvoiceNo property values for the Customer entity instance that has the CustomerID property value as 1.

Which entity SQL query should you use?

Which two actions should you perform?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application uses ADO.NET Entity Framework for persistence.

The following storage schema definition is generated for an entity named Supplier.

<EntityType Name="Supplier">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="int" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="Country" Type="char" MaxLength="3" />
<Property Name="City" Type="nvarchar" MaxLength="20" />
</EntityType>

You need to map the City column and the Country column as a separate type named Address in the conceptual schema.

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)


Page 2 of 812345...Last »