Why sql Data Reader object not created

Answer Posted / shakeer

We don't require to create object of DataReader class.

Because , For Example

if any string value is there like "Hello"
we will capture that value into String Class varible.

String s = "Hello";

In the same way when we call ExecuteReader() method, the
return type is DataReader


METHOD RETURN TYPE
ExecuteReader() ----> Datareader

DataReader: Which is having the capacity of holding the data
in the form of Rows and Columns

when we need to capture the value of string type, we
created the variable of the String class & captured it.
Similarly in the case of Datareader, we will create variable
of Datareader and capture the return type of ExecuteReader()
method.


So, DataReader dr = cmd.ExecuteReader();

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which control of the BindingNavigator returns the current position within the data source?

929


What is the default Timeout for SqlCommand.CommandTimeout property?

738


What do you know about ado.net's objects?

712


What is data control techniques?

694


Explain the difference between data reader and data adapter?

711


What are good ado.net object to replace to ado recordset object.

787


What is the executescalar method?

789


Explain About ado.net components/objects. Usage of data adapters and tell the steps to retrieve data.

787


What is commandbuilder in ado.net?

725


What is difference between ado and other data object?

670


What is ado object model?

701


What is dao and ado?

706


Which is faster sqldataadapter and sqldatareader?

706


What is connection pooling and what is the maximum pool size in ado.net connection string?

720


Give an example that shows how to execute a stored procedure in ado.net?

795