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 insert at line 11?

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 analyzes large amounts of transaction data that are stored in a different database.
You write the following code segment. (Line numbers are included for reference only.)

01 using (SqlConnection connection = new SqlConnection(sourceConnectionString))
02 using (SqlConnection connection2 = new SqlConnection(destinationConnectionString))
03 using (SqlCommand command = new SqlCommand())
04 {
05 connection.Open();
06 connection2.Open();
07 using (SqlDataReader reader = command.ExecuteReader())
08 {
09 using (SqlBulkCopy bulkCopy = new SqlBulkCopy(connection2))
10 {
11
12 }
13 }
14 }

You need to copy the transaction data to the database of the application.

Which code segment should you insert at line 11?

Which code segment should you insert at line 06?

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

The application contains a TextBox control named txtProductID. The application will return a list of active products that have the ProductID field equal to the txtProductID.Text property.
You write the following code segment. (Line numbers are included for reference only.)

01 private DataSet GetProducts(SqlConnection cn) {
02 SqlCommand cmd = new SqlCommand();
03 cmd.Connection = cn;
04 SqlDataAdapter da = new SqlDataAdapter(cmd);
05 DataSet ds = new DataSet();
06
07 da.Fill(ds);
08 return ds;
09 }

You need to populate the DataSet object with product records while avoiding possible SQL injection attacks.

Which code segment should you insert at line 06?

Which line of code should you insert at line 02?

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

The application has a DataTable object named OrderDetailTable. The object has the following columns:

ID
OrderID
ProductID
Quantity
LineTotal

The OrderDetailTable object is populated with data provided by a business partner. Some of the records contain a null value in the LineTotal field and 0 in the Quantity field.
You write the following code segment. (Line numbers are included for reference only.)

01 DataColumn col = new DataColumn("UnitPrice", typeof(decimal));
02
03 OrderDetailTable.Columns.Add(col);

You need to add a DataColumn named UnitPrice to the OrderDetailTable object.

Which line of code should you insert at line 02?

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 query = "Select EmpNo, EmpName from dbo.Table_1;select Name,Age from dbo.Table_2";
SqlCommand command = new SqlCommand(query, connection);
SqlDataReader reader = command.ExecuteReader();

You need to ensure that the application reads all the rows returned by the code segment.

Which code segment should you use?

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 connects to a Microsoft SQL Server 2005 database.

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

01 using (SqlConnection connection = new SqlConnection(connectionString)) {
02 SqlCommand cmd = new SqlCommand(queryString, connection);
03 connection.Open();
04
05 while (sdrdr.Read()){
06 // use the data in the reader
07 }
08 }

You need to ensure that the memory is used efficiently when retrieving BLOBs from the database.

Which code segment should you insert at line 04?

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 queryString = "Select Name, Age from dbo.Table_1";
SqlCommand command = new SqlCommand(queryString, (SqlConnection)connection));

You need to get the value that is contained in the first column of the first row of the result set returned by the query.

Which code segment should you use?


Page 8 of 8« First...45678