Solved

loading SqlDataReader into a DataTable object

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

790 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