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 are the difference between function and stored procedure in .net programming language?
What is owin authentication?
In Data grid the question is below quantity price total these are 3 fields available in data grid if you enter quantity the total has to update automatically.Price field is already filled completely
What is ascx?
Do cookies store passwords?
What is state management react?
How to disable cut, copy and paste in TextBox using jQuery in asp.net?
Explain security types in asp.net?
What is difference between mvc and asp.net? : Asp.Net MVC
What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?
What is state management technique?
What is the difference between the response.write() and response.output.write() methods?
How is session id generated?
What are the new features added from ASP to ASP.NET?
Which platform does Microsoft .NET use for exchanging data between applications?