I have 153 email addresses returned from a stored procedure (this number could vary) which I load into a SqlDataReader
(r
). My email relay server can send up to 50 email addresses at a time. How can I create X number of groups so I don't exceed its limit, from the reader?
Dim myCommand As New SqlCommand("sproc_Get_Emails", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add(New SqlParameter("@List_Type", SqlDbType.Char))
myCommand.Parameters("@List_Type").Value = priority
Dim r As SqlDataReader
myConnection.Open()
r = myCommand.ExecuteReader()
I am at a blank on how to do this. My thinking was along this...
'get count of all email addresses and divide by 50, then send each in 50 record batches???
Dim email_count As Integer = 0
'get count and divide by 50
email_count = r.RecordsAffected
Dim list_size As Double = email_count / 50
Any help would be much appreciated.