PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 07?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The application connects to a Microsoft SQL Server 2008 database. The database includes a table named dbo.Documents that contains a column with large binary dat a. You are creating the Data Access Layer (DAL). You add the following code segment to query the dbo.Documents table. (Line numbers are included for reference only.)

01public void LoadDocuments(DbConnection cnx)
02{
03var cmd = cnx.CreateCommand();
04cmd.CommandText = “SELECT * FROM dbo.Documents”;
05…
06cnx.Open();
07
08ReadDocument(reader); }

You need to ensure that data can be read as a stream. Which code segment should you insert at line 07?

PrepAway - Latest Free Exam Questions & Answers

A.
var reader = cmd.ExecuteReader(CommandBehavior.Default);

B.
var reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);

C.
var reader = cmd.ExecuteReader(CommandBehavior.KeyInfo);

D.
var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);


Leave a Reply