I’m new to Asp.net (though I am experienced in PHP).
Is there a way to select certain rows and for each row, perform a function? Specifically, I want to select specific rows and then send them an email.
Here’s a breakdown:
- Select * from STUDENTS where status = active
- For each row that is returned, take the $email column and email the student message
- Repeat until all qualifying rows have been completed.
Thanks!
Well, that depends on how you going to do the query.
- Use “select columname1, columnname2 from students where status = 1”
if you are selecting this with a data reader you can do it within the reader:
SqlCommand selectCmd = new SqlCommand("select string here",connection)
SqlDataReader reader = selectCmd.ExecuteReader();
while (reader.Read())
{
string useremail = reader["MemberEmailColumnName'].ToString();
//SEND EMAIL HERE
}
Thank you both!
I think I can figure it out form here.
To imaginekitty, I swear I search for the ‘foreach’ option and couldn’t find it! 
NightStalker-DNS, thank you for the example!!