Hard
You are using Visual Studio 2010 and the .NET Framework 4.0 to create an application. This application connects to a SQL Server 2008 database. The database has a table dbo.Documents that contains a column with binary data. You are creating the data access layer.
You add the following code to query the dbo.Documents table.
01 public void LoadDocuments(DbConnection cnx)
02 {
03 var cmd = cnx.CreateCommand();
04 cmd.CommandText = "SELECT * FROM dbo.Documents";
05 ...
06 cnx.Open();
07
08 ReadDocument(reader);
09 }
You need to ensure that the data can be read into a stream (System.IO.Stream). What line of code should you insert at line 07?
Author: Guillaume BroutStatus: PublishedQuestion passed 188 times
Edit
0
Community Evaluations
Auteur anonyme
29/04/2024
var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
Cette option indique que les donnĂ©es binaires doivent ĂȘtre lues de maniĂšre sĂ©quentielle, ce qui est gĂ©nĂ©ralement nĂ©cessaire pour les donnĂ©es de grande taille telles que les donnĂ©es binaires stockĂ©es dans une base de donnĂ©es.
Similar QuestionsMore questions about Dot-net
1
Retrieve a list of products from a catalog in a .NET application1
How to get the first element of an array in C#1
How to use the 'using' statement in C#0
How to get the products of a category in Dot-net0
Write a LINQ query to select all rows from the first table in the dataset where the ContactName field is not null.