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

Which keyword is used to accept variable number of parameters?

890


What is the difference between sqldatareader and sqldataadapter?

738


What is DataRowCollection?

851


What are the benefits of using ado.net?

733


How many major types of connection objects in ADO.NET?

828


describe the dataset object in ado.net.

734


What is openquery?

732


What is commandbuilder in ado.net?

747


What are the main differences between classic ado and ado.net?

762


What is ado circle?

898


What is microsoft ado?

721


What is the difference between data reader and data adapter?

798


What is datasource in ado.net?

836


Is datareader faster than datatable?

745


What is difference between ado.net and asp net?

766