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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 ( DataReader or DataSet when pulling multiple recordsets in ASP.NET ) is very similar. Hopefully the info above will help you along.)