G
Guest
I receive an error with the following language (error message indicate at ** below)
Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Clic
Dim DBConn As SqlConnectio
Dim DBCommand As SqlDataAdapte
Dim DSPageData As New DataSe
Dim TheMailMessage As New MailMessag
** Dim TheMailConnection As SmtpMail 'This s/b New SmtpMail - I receive the following error with
** 'TheMailConnection when I put New in:
** ' 'System.Web.Mail.SmtpMail.Private Sub New()' is not accessible in this context because it is 'Private
Dim I As Intege
DBConn = New SqlConnection("data source=z;initial catalog=C4EmailBlast;integrated security=SSPI;"
DBCommand = New SqlDataAdapter
("Select Distinct CustomerEmail from Customers "
& "Where GroupName= '"
& ddlGroupName.SelectedItem.Text & "'", DBConn
DBCommand.Fill(DSPageData, "Emails"
TheMailMessage.From = txtFrom.Tex
TheMailMessage.Subject = txtSubject.Tex
TheMailMessage.Body = txtMessage.Tex
For I = 0 To DSPageData.Tables("Emails").Rows.Count -
TheMailMessage.To = DSPageData.Tables("Emails").
Rows(0).Item("CustomerEmail"
TheMailConnection.Send(TheMailMessage
Nex
If DSPageData.Tables("Emails").Rows.Count = 1 The
lblMessage.Text = "Your message has been sent to 1"
& " person. You can now send another email blast.
Els
lblMessage.Text = "Your message has been sent to "
& DSPageData.Tables("Emails").Rows.Count
& " people. You can now send another email blast.
End I
End Su
Does anyone know why this error is being generated and how I can fix the code so it works
Any help you can give me will be greatly appreciated
Sand
Sub btnOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.Clic
Dim DBConn As SqlConnectio
Dim DBCommand As SqlDataAdapte
Dim DSPageData As New DataSe
Dim TheMailMessage As New MailMessag
** Dim TheMailConnection As SmtpMail 'This s/b New SmtpMail - I receive the following error with
** 'TheMailConnection when I put New in:
** ' 'System.Web.Mail.SmtpMail.Private Sub New()' is not accessible in this context because it is 'Private
Dim I As Intege
DBConn = New SqlConnection("data source=z;initial catalog=C4EmailBlast;integrated security=SSPI;"
DBCommand = New SqlDataAdapter
("Select Distinct CustomerEmail from Customers "
& "Where GroupName= '"
& ddlGroupName.SelectedItem.Text & "'", DBConn
DBCommand.Fill(DSPageData, "Emails"
TheMailMessage.From = txtFrom.Tex
TheMailMessage.Subject = txtSubject.Tex
TheMailMessage.Body = txtMessage.Tex
For I = 0 To DSPageData.Tables("Emails").Rows.Count -
TheMailMessage.To = DSPageData.Tables("Emails").
Rows(0).Item("CustomerEmail"
TheMailConnection.Send(TheMailMessage
Nex
If DSPageData.Tables("Emails").Rows.Count = 1 The
lblMessage.Text = "Your message has been sent to 1"
& " person. You can now send another email blast.
Els
lblMessage.Text = "Your message has been sent to "
& DSPageData.Tables("Emails").Rows.Count
& " people. You can now send another email blast.
End I
End Su
Does anyone know why this error is being generated and how I can fix the code so it works
Any help you can give me will be greatly appreciated
Sand