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 architecture does Datasets follow?

815


Explain all the classes those are used for database connections between sql server and asp.net?

764


How can you identify whether or not any changes are made to the DataSet object since it was last loaded?

813


What is difference between dataset and datatable?

791


What is ado or jdbc?

715


Explain why canot we use multiple inheritance and garbage collector paralelly in .net?

818


What is the difference between Response.Expires and Reponse.ExpiresAbsolute?

812


Define executenonquery?

716


How is it possible to get 2 tables of data at a time by using data reader?

712


What is a column variable?

709


Can we load multiple tables in a dataset?

823


What is isolation?

787


Some important instruction regarding ADO.NET connection string ?

772


What is openquery?

735


What are the major difference between classic ADO and ADO.NET?

759