Solved

loading SqlDataReader into a DataTable object

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now