harrypalmerr 0 Newbie Poster

You may use RecordsAffected property of SQLDataReader for counting the number of emails sent per user, but as it is not set until all rows are read and you close the SqlDataReader, you must assign seperate datareader object to select all records per user.

harrypalmerr 0 Newbie Poster

Memory allocation in C# generates some security related problems such as unauthorised access to the data being passed by reference. This is because garbage collector performs the task of deallocating the memory assigned on heap for such variable periodically. In the meantime, some unauthorised access can occur by third party invaders. Data stored on the heap : content of reference-type objects or anything structured inside a reference-type object. An explicit call to Object.Dispose() method by user can be done to avoid this.

harrypalmerr 0 Newbie Poster

When the stored procedure size is very large in pages, you could distribute the functionality easily with some of the processing coded in the application.

On the other hand, many developers write their entire database calls in application code. Obviously, it eliminates the database server completely without any use of processing power of database. But this creates a static code that must be updated as and when dynamic changes to database tables occur. So to avoid this, you must use stored procedures offloading processing from your application.