最后天上班了,突现一个问题。
我数据库调用的语句为select mail,nickname from newregister where nickname in (select name from custom1 where company = '"+lbl_com_cn.Text+"')。会出现1-7条数据不等。我用的.NetMail邮件发送,在button_click中,别人一点提交邮件自动发送到1-7个邮箱。问题出来了,当取出数据大于1时, 只发送第一条数据对应的邮箱。我想实现取出4条数据全部发送,取出一条数据只发送一条这样的程序。求大神改进!using System.Net.Mail;        MailAddress from = new MailAddress("[email protected]","xxx");
        MailAddress to = new MailAddress(lbl_mail.Text,lbl_nickname.Text);
                      MailMessage myMail = new MailMessage(from,to);
        myMail.Subject = "在线咨询问题";
        myMail.Body =  this.lbl_name.Text +
        Environment.NewLine + this.lbl_com_cn.Text +
        Environment.NewLine + this.lbl_emp_mph.Text +
        Environment.NewLine + emp_no.ToString() +
        Environment.NewLine + TextBox1.Text +
        Environment.NewLine + TextBox2.Text + 
        Environment.NewLine + values.ToString()+
        Environment.NewLine + TextBox3.Text +
        Environment.NewLine + value.ToString();        
        myMail.IsBodyHtml = true;
        myMail.BodyEncoding = System.Text.Encoding.GetEncoding("GB2312");
        myMail.Priority = MailPriority.High;        SmtpClient client = new SmtpClient();
        client.Host = "xxxxxxx";
        client.Credentials = new NetworkCredential("[email protected]","xxxxxx");      
        client.Send(myMail);