Why sql Data Reader object not created

Answer Posted / manish t

the command in the above code uses cmd.executereader ()
which means an datareader object is returned as a result of
the execution .....which essentially means one datar reader
object getting assigned to another datareader object

dr = cmd.executereader

so it is simply assigning of objects and does not require
new keyword as the datareader inside the execute reader has
already allocated space and it is just assigning it to a
different object ...this is true with executedataset as
well ...remember the rule is that corret type should be
returned. it is same in case of any objects ..try creating
an object A with new keyword and another object B of same
type without new key word ...and then assign the A to B and
you will find that By ref all properties are avialable to b

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to aggregating data across related tables?

777


Define table relations?

740


Which object needs to be closed?

1985


What are the steps you will take to improve performance? Will you use dataset or datareader?

744


Explain ODP.net

767


What does executequery return?

709


How to enable and disable connection pooling?

737


Is it possible to load multiple tables in a Dataset?

754


What are the different methods by which we can populate a dataset?

949


What is difference between datatable and dataset?

738


Define data access layer?

721


What is oledb driver?

706


What is ole2 format?

680


What is microsoft ado?

700


How we can provide data to ado.net?

757