使用SQL语句生成数据表作为邮件内容
Dim m As New MailSender
m.Host = "smtp.qq.com"
m.Account = "xxx@xxx.com"
m.Password = "swyyxxxxabd"
m.From = "xxx@xxx.com"
m.EnableSsl = True
m.Port= "25"
m.To ="xxx@xx.com"
m.Encoding = Encoding.UTF8
m.Title = "工作报告"
m.C
m.SendAsync()
Dim cmd As new SQLCommand
cmd.C
Dim dt As DataTable
Dim sql As String = "sel ect form_id 表单编号,form_name 表单名称,eqp_id 设备编号,mat_id 物料编号,count(form_id) 点检记录数 ,count( case when isOutSpec = 1 then 1 end ) 超标记录数 from V_ems_checklist_reco where " & filter.trim("'") & " group by form_id,form_name,eqp_id,mat_id"
cmd.CommandText = sql
dt = cmd.ExecuteReader()
t1.DataSource = dt