views:

28

answers:

1

hi all I have heard that in web-based applications, when we want to get data from DB, it's better to collect data into a data reader instead of a data table.

What 's your choice?

+1  A: 

DataReaders and DataTables do two very different things. A DataReader is a forward-only "device" to grab data from a table. A DataTable allows you to persist that data in memory.

So, to answer your question, I would use a DataReader to get data for a web-based application. That being said, you could also use a DataTable to store the information you grabbed (in a session variable, for example) so that you don't have to grab the data from the database again.

(By the way, I also voted to close since ( http://stackoverflow.com/questions/180283/datareader-or-dataset-when-pulling-multiple-recordsets-in-asp-net ) is very similar. Hopefully the info above will help you along.)

Michael Todd
Thank you Michael
odiseh