• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

sqldatareader or sqldatadapter

I have a Win app which gets data from sql and write to formfill in pdf using ActivePDF. Total columns is 50. Is it better to use sqldatareader to read each row at a time (per each account) and fille out labels, create directory to store them or use sqldataadapter, fill it to datatable instead and then loop them?  This could be up to 1000 or 2000 accounts.
0
VBdotnet2005
Asked:
VBdotnet2005
  • 2
2 Solutions
 
CodeCruiserCommented:
Both would be fine as the data is not huge. Would really depend on the structure of your code. You would be looping in both cases. If the data is being loaded from a remote server then I would be inclined to use a datatable.
0
 
VBdotnet2005Author Commented:
Would you perfer to use sqldatareader or sqldataadapter ?
0
 
CodeCruiserCommented:
I think I tried to answer that question in my comment above.
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
When you do not need to update the data afterward, the SqlDataReader is usually a better choice. It is faster and requires less resources. A collection or dictionary usually also takes up less resources than a DataTable.

But as always, a lot of factors come into account, so the only way to be sure is to test both.

I would bet on the DataReader though.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now