Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

loading SqlDataReader into a DataTable object

Posted on 2007-04-07
3
Medium Priority
?
371 Views
Last Modified: 2012-05-05
I am writing a commerical website in asp.net I know that the SqlDataReader is the fastest way to read data from the database, but the bad thing about it is that it requires an open connection to operate. I read in a book that I can load all the data returned by the SqlDataReader into a DataTable object, which is capable of storeing the data offline without needing an open connection, then use that DataTable object to bind it to my UI controls. Does that sounds like a good design?
0
Comment
Question by:pharosinnyc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Expert Comment

by:steveberzins
ID: 18870892
long story short, not enough information in your question to say it is good or bad. :)

With little information to go on, it is probably the safest for most situations to pass stuff around in DataSets/DataTables and not keep connections open longer than absolutely necessary.
0
 
LVL 5

Accepted Solution

by:
asp_lha earned 2000 total points
ID: 18871615
You can use DataReader or DataSet to get data, it's up to your architecture

here is a article discuss about this:
Contrasting the ADO.NET DataReader and DataSet
http://msdn.microsoft.com/msdnmag/issues/04/06/DataPoints/

0
 

Author Comment

by:pharosinnyc
ID: 18873044
for my architecture, I will have a data store, data access layer, business layer and UI. I might merge the data access layer with the business layer though..
It looks like my question doesn't have a specific answer. Each technique has its pros and cons.
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question