Solved

loading SqlDataReader into a DataTable object

Posted on 2007-04-07
3
364 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
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 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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