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
What is the main difference between Asp.net and Vb.net?
What is viewstate? What does the “enableviewstate” property do?
In which event of the page life cycle, is the viewstate available?
What are all the various Estimation Techniques available ?
What are validator? Name the validation controls in asp.net?
What is the equivalent of date() and time() in asp.net?
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
What are the Types of authentications in IIS
How you will improve web application performance?
What is sdlc process?
what is a .xap file? Explain with an example.
Give a few examples of page life cycle events.
What does uri mean?
What's the ASP.Net Application life cycle?
Which property needs to be set for script manager control to extend the time before throwing time out expection if no response is received from the server?