我正在尝试制作一个程序,将查询结果(在数据集中)通过电子邮件发送给用户......我的代码是:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Paid_Out_TbTableAdapter.Fill(Me.dataset.Paid_Out_Tb)
Me.ReportViewer1.RefreshReport()
Try
Dim SmtpServer As New SmtpClient()
Dim mail As New MailMessage()
SmtpServer.Credentials = New _
Net.NetworkCredential("Bob", "password")
SmtpServer.Port = 25
SmtpServer.Host = "server"
mail = New MailMessage()
mail.From = New MailAddress("email@email.com")
mail.To.Add("Email@email.com")
mail.Subject = "Test Mail"
mail.Body = (Me.DataSet.Paid_Out_Tb.ToString)
SmtpServer.Send(mail)
MsgBox("mail send")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
除了发送电子邮件正文外,一切正常......我怎样才能将结果作为正文发送到电子邮件?