Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am developing an application where I need to send the Emails to all the users in the table. Since the number of users is in millions, so to select all the users at once won’t do any good. Is there any way I can send emails in a group of 20 or 30 users so that the next time it will select the next 20 users dynamically and send emails. Any help will be appreciated.
Posted

1 solution

It will not be optimal for you to fetch records in groups of 30 from the database. To optimize this connection and network overhead, get all data using a single query. Put this data in a DataTable.

Loop through groups of 30 in the DataTable, get the email ids and send mails before proceeding with the next 30.
 
Share this answer
 
Comments
Nandakishore G N 13-Apr-13 4:56am    
good answer...abhinav..my 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900