Advantage of data Reader?

Answers were Sorted based on User's Feedback



Advantage of data Reader?..

Answer / o p yadav

To highlight the advantages of using a DataReader over the
DataSet, here’s an example of using a DataSet. The following
fills a DataSet with the results from a table, and outputs
the first field in each row:

Code=

SqlConnection conn = new SqlConnection(connectionString);
SqlDataAdapter a = new SqlDataAdapter
("select * from mytable;",conn);
DataSet s = new DataSet();
a.Fill(s);
foreach (DataRow dr in s.Tables[0].Rows)
{
Console.WriteLine(dr[0].ToString());
}

As you can see, we don’t actually start the actual
inspection of data (the foreach loop), until the whole
DataSet has been filled. There may be occasions where we may
not use all our results, or we might execute other code
while inspecting (a progress bar’s progress is a trivial
example). Using a DataSet, this can only take place after
the complete results are fetched and passed into the various
collections within the DataSet.

Is This Answer Correct ?    3 Yes 2 No

Advantage of data Reader?..

Answer / athira

The datareader object allows users to read and output each
column of a multi-column asci file (up to 64 columns)
through a separate outlet. Each line can be output
sequentially, forward or backward, or by indicating a
specific line number. The object also includes simple
interpolation and smoothing between lines

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

Where sessions are stored?

0 Answers  


With out Web.config can we executes the application?

10 Answers   Valtech,


why we should use more than one web.config files in our application? I have two web.config files in my application. One in the root directory and another one inside a sub folder. When the application runs which web.config file will run? why?

1 Answers  


what do machine key element in configuration file specify?

1 Answers   TCS,


WHAT IS polymorphism

2 Answers   Fidelity,






Explain the difference between page.registerclientscriptblock and page.registerstartupscript?

0 Answers  


What do you mean by query string?

0 Answers  


About remoting and web services. Difference between them?

2 Answers   Microsoft,


Why Unload event of MasterPage Calls first in ASP.net ?

0 Answers   HCL,


How to write test case (Unit test plan)

1 Answers   Syntel,


Describe the difference between inline and code behind - which is best in a?

0 Answers  


How you can access the values from the Repeater control in ASP.NET?

0 Answers  


Categories