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...

Advantage of data Reader?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is __ requestverificationtoken?

936


What is a web api? Which protocol is used in a web api?

980


What are the session management techniques asp net?

950


Why do I get error message "could not load type" whenever I browse to my asp.net web site?

1101


Difference between using directive vs using statement?

937


What is globalization and localization in asp net?

917


Can you explain page lifecycle in net?

923


What is asp.net globalization?

932


How does a web application session work?

1021


What is syntax code to send email from an asp.net application?

972


How do u optimize a query in asp.net?

953


How can we identify that the page is post back in asp net?

894


Give a few examples of page life cycle events.

1075


What is difference between view state and session state?

815


Define dll hell?

1039