This topic is locked
[SOLVED]

 Emailing from a SELECT in BeforeAdd Event

3/16/2018 10:58:47 AM
ASPRunner.NET General questions
J
JOHNF777 author

I have the following code:

*

string strSQLExists2 = "Select from MYTABLE where (EmpEmail > ' ' AND IssueDate = CONVERT(DATETIME, '" + DueDate +"', 102)) AND (JobID='" + values["JobNo"].ToString() + "')";

XVar rsExists2 = CommonFunctions.db_query(strSQLExists2, null);

XVar rsTemp2 = CommonFunctions.db_fetch_array(rsExists2);
email1 = rsTemp2["EmpEmail"].ToString();
msg = "YOU HAVE BEEN AWARDED " + rsTemp2["QTY"].ToString() ;

XVar ret = MVCFunctions.runner_mail(new XVar("to", "xyz@mydomain.com", "subject", "Award", "body", msg, "from", "admin@mydomain.com"));
if(!ret["mailed"]){

MVCFunctions.EchoToOutput(ret["message"]);

}


What I'd like to do is to email all the users found in the table with the SELECT statement. My table contains a field that has the email address. The code above is only sending to the first record found.
How do I code this so it send to all records found?
Thanks in advance.

I
i.NoLim 3/16/2018

Check out this link.
https://xlinesoft.com/asprunnernet/docs/send_email_to_email_addresses_from_user_table.htm
It seems like you are missing your "while" statement.

J
JOHNF777 author 3/16/2018

Thanks! That worked!