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

Explain the difference between value type and reference type?

639


What is the good practice to implement validations in aspx page?

1080


What are the different types of validation controls in asp.net?

1032


How do session tokens work?

933


What is another word for redirect?

931


Define the steps to set up validation control.

1020


What is asp.net and its advantages?

969


Explain the difference between AutoPostBack and IspostBack in ASP.NET?

1052


How do you sign out from forms authentication?

1037


Is asp.net core faster?

988


What is the difference between union and structure?

939


1.can we add connection string in global.asax?????????? 2.what are the default files included when we create new web application????

20942


What are assemblies and namespaces and explain the difference between them ?

1065


What is the difference between asp.net and mvc?

1092


How does viewstate work?

1047