what should you do to ensure that each image is returned as a Stream instance that can be read on demand?

You have received instructions to call a stored procedure that return images from a Microsoft SQL Server 2005 database.
You want to use the SqlDataReader class to read the returned images. To ensure that each image is returned as a Stream instance that can be read on demand, what should you do?

You have received instructions to call a stored procedure that return images from a Microsoft SQL Server 2005 database.
You want to use the SqlDataReader class to read the returned images. To ensure that each image is returned as a Stream instance that can be read on demand, what should you do?

A.
To the ExecuteReader method of a SqlCommand instance, specify CommandBehavior.SequentialAccess as a parameter.

B.
For the SqlConnection instance that represents the database connection, set the Packet Size connection string property to 0.

C.
For a SqlCommand instance, call the Prepare method followed by the ExecuteNonQuery method.

D.
Call the BeginTransaction method of a SqlConnection instance and specify IsolationLevel.Serializable as a parameter.

Explanation:
You need to specify CommandBehavior.SequentialAccess as a parameter. The Microsoft .NET DataProvider for SQL Server will load the returned data as steam.

Incorrect Answers:
B: You should not set the size to 0. This will not instruct the Microsoft .NET DataProvider for SQL Server will load the returned data as steam.
C: The ExecuteNonQuery method executes SQL commands and does not return row sets.
D: The IsolationLevel.Serializable enumeration member shows that a lock should be placed to prevent transactions from updating or inserting rows into the DataSet instance.



Leave a Reply 0

Your email address will not be published. Required fields are marked *