Which of the following will you use to retrieve rows from a data source in a DataReader?

Which of the following will you use to retrieve rows from a data source in a DataReader?

Which of the following will you use to retrieve rows from a data source in a DataReader?

A.
GetData

B.
GetValues

C.
Read

D.
ExecuteReader

Explanation:
You can retrieve data using a DataReader by creating an instance of the Command object and then
creating a DataReader by calling Command.ExecuteReader to retrieve rows from a data source.

Answer C is incorrect. The Read() method is used to read a DataReader.

Answer A is incorrect. The GetData() method returns a DbDataReader object for the requested
column ordinal.

Answer B is incorrect. The GetValues() method populates an array of objects with the column values
of the current row.



Leave a Reply 0

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