Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Why sql Data Reader object not created

Answers were Sorted based on User's Feedback



Why sql Data Reader object not created..

Answer / 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

Why sql Data Reader object not created..

Answer / alex dorfman

The type 'System.Data.SqlClient.SqlDataReader' has no
constructors defined

Is This Answer Correct ?    11 Yes 5 No

Why sql Data Reader object not created..

Answer / boopathiraj

we can't create an object for data reader because the
datareader is used to retrive the data's from the database
and it uses only some small amount of databases unlike
dataset.We can just create the variable for the datareader
is possible.And then THE CONSTRUCTORS WAS NOT DEFINED BY
SYSTEM.DATA.SQLCLIENT.SQLDATAREADER.(i.e)when you typed
(System.data.sqlclient)upto this is possible if you use
(System.data.sqlclient)(.sqldatareader)--->Not possible and
it is applicable when you use microsoft visual studio.net

Is This Answer Correct ?    8 Yes 4 No

Why sql Data Reader object not created..

Answer / tahir

The DataReader object is the ADO.NET counterpart of the read-only, forward-only default ADO cursor. The DataSet is a container that can be programmatically filled with static snapshot of data. In this sense, it can be seen as a repository of disconnected recordsets. There's no Recordset component in the ADO.NET object model, but the DataTable object is the .NET double of a disconnected recordset.

Is This Answer Correct ?    2 Yes 1 No

Why sql Data Reader object not created..

Answer / kalirajan

SqlConnection con = new SqlConnection("");
con.Open();
SqlCommand cmd = new SqlCommand("", con);

SqlDataReader dr;

dr = cmd.ExecuteReader();
while (dr.Read())
{
TextBox1.Text = dr[0].ToString();


}

dr.Close();


Try this code...

Is This Answer Correct ?    8 Yes 8 No

Why sql Data Reader object not created..

Answer / tahir

The DataReader object is the ADO.NET counterpart of the read-only, forward-only default ADO cursor. The DataSet is a container that can be programmatically filled with static snapshot of data. In this sense, it can be seen as a repository of disconnected recordsets. There's no Recordset component in the ADO.NET object model, but the DataTable object is the .NET double of a disconnected recordset.

Is This Answer Correct ?    2 Yes 2 No

Why sql Data Reader object not created..

Answer / 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

Why sql Data Reader object not created..

Answer / manish

after some investigation i have found that because the
sqldatareader has no constructor defined in it an object
cannot be created.

Is This Answer Correct ?    2 Yes 4 No

Why sql Data Reader object not created..

Answer / deep

because it ia an abstract class

Is This Answer Correct ?    7 Yes 13 No

Post New Answer

More ADO.NET Interview Questions

Explain the difference between sqlcommand object and command behavior object?

0 Answers  


What is openquery?

0 Answers  


How to insert multiple records in asp .net from Gridview to Sql Database with out using loop condition ?

2 Answers  


Explain the role of data provider in ado.net? What is the role of data provider in ado.net?

0 Answers  


What we do with the object of ado.net dataset after using it?Can we dispose it or can we set it nothing?Is it must or not?

4 Answers   SVI,


What is serialization and de-serialization in .net?

0 Answers  


what is meant by connection pooling and event pumbling in ado.net

3 Answers   TCS,


How to retrieve the third table value from the data set?

2 Answers   Network Solutions,


What are the different row versions available in table?

0 Answers  


I want to ask u that if i add radio button in ado.net form,and how radion button data insert in SQL2005 Database...

6 Answers  


What is ado and rdo?

0 Answers  


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

0 Answers  


Categories