Get the data from the database with a new statement:
select byEmail from ContactDetails where byEmail = 'Y'
Then in c#:
foreach(DataRow row in YourDataSet.Tables["YourTable"].Rows)
sendYourEmailTo( row["byEmail"].ToString() );
Or if you already have the dataset loaded...
DataRow[] emailers = YourDataSet.Tables["YourTable"].Select("byEmail = 'Y'");
foreach(DataRow row in emailers)
sendYourEmailTo( row["byEmail"].ToString() );
Or if using an SqlDataReader...
SqlConnection conn = new SqlConnection( YourConnectionString );
SqlCommand cmd = new SqlCommand("select byEmail from ContactDetails where byEmail = 'Y'",conn);
conn.Open();
SqlDataReader row = cmd.ExecuteReader();
while (row.Read())
{
sendYourEmailTo( row["byEmail"].ToString() );
}
conn.Close();
// Jerry
PS: Just typed off the top of my head, so verify syntax before use.