.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Using a DataSet

Posted By:Shashi Ray       Posted Date: November 27, 2009    Points: 15    Category: .Net Framework    URL: http://www.dotnetspark.com  


Using a DataSet

Use a DataSet populated by a SqlDataAdapter object when:

  • You require a disconnected memory-resident cache of data, so that you can pass it to another component or tier within your application.
  • You require an in-memory relational view of the data for XML or non-XML manipulation.
  • You are working with data retrieved from multiple data sources, such as multiple databases, tables, or files.
  • You want to update some or all of the retrieved rows and use the batch update facilities of the SqlDataAdapter.
  • You want to perform data binding against a control that requires a data source that supports IList.

More Information

If you use a SqlDataAdapter to generate a DataSet or DataTable, note the following:

  • You do not need to explicitly open or close the database connection. The SqlDataAdapter Fill method opens the database connection and then closes the connection before it returns. If the connection is already open, Fill leaves the connection open.
  • If you require the connection for other purposes, consider opening it prior to calling the Fill method. You can thus avoid unnecessary open/close operations and gain a performance benefit.
  • Although you can repeatedly use the same SqlCommand object to execute the same command multiple times, do not reuse the same SqlCommand object to execute different commands.




Shashi Ray

 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend