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

how can u create the forms authentication?and what is the difference between forms authentication and windows authentication?

2 Answers   IBM,


What is asp net theme?

0 Answers  


What are the asp.net list controls and difference between them?

0 Answers  


What are validators and list some validators of asp.net?

0 Answers  


In SP has contains 10 query,By Using Dataset Object I need to fetch 8th query of records? How?

5 Answers  






What is difference between URL and URI?

0 Answers   MCN Solutions,


after which page life cycle event all properties of control will be "fully loaded "

10 Answers   FactorH,


How can we read a columnised text data in ASP.Net C#? Columnised means my data is stored in a text file and I have numeric data or string data in this file. For ex. If I am searching for the data of gender and I know that gender data is stored at column 32 in text file. How can I get this data in ASP.Net page. Thanks for help in advance.

2 Answers  


How do you handle session management in ASP.NET and how do you implement them. How do you handle in case of SQLServer mode ?

0 Answers   Microsoft,


Explain the use of fragment caching.

0 Answers  


what is view stat how it is use ?

2 Answers   Amazon,


Write a standard lock() plus double check to create a critical section around a variable access?

1 Answers  


Categories