Microsoft Exam Questions

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?

A.
SqlDataReader sdrdr = cmd.ExecuteReader();

B.
SqlDataReader sdrdr = cmd.ExecuteReader(CommandBehavior.Default);

C.
SqlDataReader sdrdr = cmd.ExecuteReader(CommandBehavior.SchemaOnly);

D.
SqlDataReader sdrdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);