reiterate through large collect 100 items at a time

2012-08-14  Source: Original Site  Category:VB.NET  Views:0 


I have a routine that is supposed to grab all email addresses within a certain group. The email address list can be well over 1000 emails. When emailing it out though I can only send around 150 emails at a time. So what I i've done is executed a query and threw all the emails into a collection.

How do I now reiterate through the collection grab 100 addresses each time and call the routine to email that group?

Dim emailToGroup As String = ddlEmailTo.SelectedValue

Dim connStr As String = ConfigurationManager.ConnectionStrings("SNA_TRT").ConnectionString
Dim sqlConn As SqlConnection
sqlConn = New SqlConnection(connStr)

Dim strSQLgetEmails As String = "SELECT C.contact_email as Company FROM cust_emerg_contacts E INNER JOIN TRT_parent_accounts A ON E.CompID = A.CompID INNER JOIN MRT_customer_contacts C ON E.ContactID = WHERE (A.CARE_LEVEL LIKE '" & emailToGroup & "') AND (A.[Status] = 'Active')"

Dim cmd As New SqlCommand(strSQLgetEmails, sqlConn)
Dim dr As SqlDataReader = cmd.ExecuteReader()

Dim EmailCol As New Collection
Dim count As Integer = 0
While dr.Read
EmailCol.Add(count, dr(0))
count &= 1
End While



'Grab 100 emails stuff into a string (toEmailList) and send the message. Grab Next 100 and send message.. ect. ect
'SendMail(tbEmailFrom.Text, ToEmailList, tbEmailSubject, tbMessageBody)

Related articles
  • reiterate through large collect 100 items at a time 2012-08-14

    I have a routine that is supposed to grab all email addresses within a certain group. The email address list can be well over 1000 emails. When emailing it out though I can only send around 150 emails at a time. So what I i've done is executed a quer

  • Ubuntu backup/archive large collections 2013-12-29

    I'm looking for a backup/archive program for large collections of files. I have several large collections -- photos, and music -- in the 100s of gigabites. I'd like some software to manage backups of this stuff, to prepare for when HDs fail. I guess

  • jQuery jCarousel with many (100+) items 2014-06-18

    Hi, I'm using jCarousel (great plugin btw) in an app where it will be potentially be displaying 100+ items. Each item is a li with a div, some text and an image inside. From my experiments so far it scales OK to somewhere between 20 and 50 items and

  • How do I loop through all the child items of a tree item in a CTreeCtrl? 2012-02-02

    How do I loop through all the child items of a tree item in a CTreeCtrl? Sample code would be great!

  • Oracle more than 100 items 2012-02-16

    What happens if there are more than 100 items on a page in HTMLDB 1.6 ? They are displayed, is there an abnormal behaviour in some way ? What about HTMLDB 2.0 ?

  • Oracle Exceeding 100 items 2012-02-29

    So, we're experiencing these weird problems on our main page. This page had over 100 items on the page. On the 135th item, it wouldn't recognize the highest sequenced item on the page. It'd read it as null. For a future release, it definitely would b

  • Oracle parallel iterator through stored collection 2012-03-21

    i'm running a parallelizable operation over a StoredMap. Currently, i'm using one iterator through the collection which is consumed by N threads (with synchronized access to the iterator because they are not thread-safe). ideally, however, i would lo

  • Oracle Quick solution for "More than 100 items" problem 2012-06-12

    in a few days I have to deploy an application that has to just insert,update,delete and search on a table. It's jsut a draft to allow people inserting some data, the final app will be different. I didn't know until yesterday night about the "More tha

  • activex control collections's item 2012-08-20

    I want to write a collection,The collection's item is activex control, but when "myItem" is a "full control", in vb myCollection.add dim aa as myItem set aa=CreateObject("MyItem.1") it is error but when "myItem" is a "simple object", in vb myCollecti

  • Running a large collection of tests 2012-10-19

    guys, I'd like to find out how everyone runs a large collection of tests using RFT. I've played with a few different implementations and have become rather frustrated using codecallScript[/code] to run multiple tests as a suite because all of the log

  • Asynchronously inserting large number of items into TreeView 2012-10-22

    I need to insert a very large number of items into a CTreeView derived control. This insertion takes a long time, so I am doing is asynchronously. My problem is: whenever I call InsertItem, the tree selection jumps to the newly inserted item. I want

  • Oracle Tweaking slow search in large collection 2013-02-12

    Reagrding my posting a few weeks ago called "Indexing Large Collections," I have reformatted my XML to be much easier to index and search. I reformatted an MARCXML ( to be much simplier, here

  • Iterating through a collection 2013-04-01

    Hi, can someone help me modify this code to achieve the following: Add methods to your Human that return collections of arms and legs. implement these methods by iterating through the collection of limbs and checking what type of limb they are. Note

  • Oracle More than 100 items in Form or Page 2013-04-22

    Can Apex allow more than 100 items in a page? I am getting message like 'Item count exceeds maximum of 100'. Even data entered in the form for extra items over 100 is not posted to database. Pl help or suggest any workaround. I am using HTMLDB 2.0

  • Oracle Display as Text (Does not save State): Counts towards 100 item limit 2013-06-27

    I need to create a page with a bunch of survey type questions all over the page. If I create them as Read-only text items with type "Display as Text (Does not save State)" would they still count towards the 100-item limit per page? If so, how else wo

  • how to iterate through a collection? 2013-07-03

    can you please tell me how can i iterate through a collection of elements like IHTMLElementCollection which contains IHTMLImgElement

  • Oracle Problem with Page having more than 100 items 2013-09-06

    The page was working fine with more than 100 items in HTMLDB 1.5. After upgrading from HTMLDB 1.5 to APEX 2.2.1 I am facing problem where any button pressed in a particular page returns a 404 error message Browser Message Not Found The requested URL

  • trying to run through a collection to see if a value is in it 2013-11-19

    im trying to run through a collection of 4 numbers to see if a number is in it or not, and if it is, return true, if its not, return false. I keep getting an error message though. int list[4]={2,3,4,5} int main() { for (int i=0;i<3;i++) if list[i]

  • Pre-declaring large number of items 2013-11-23

    Once again, I'm back with a relatively "newbie" question, but I'm getting better...anyways...I want to declare a large number of items, created from classes I've made, before the actual execution of the main program, or have all of those items access

  • Oracle More than 100 items gives "/apex/www_flow.accept was not found" error 2014-01-26

    If I have more than 100 items on a page, it is giving me "Requested URL /apex/www_flow.accept was not found on this server" while creating or saving the record. The moment I delete the extra items it starts working fine. Is there any limitation that