Advertisement

07.03.2008 at 07:13AM PDT, ID: 23536900
[x]
Attachment Details

vb.net MySQL, visual studios 2008

Asked by AndyK167 in Visual Studio 2008, MySQL, Microsoft Visual Basic.Net

Tags: vb.net MySQL, visual studios 2008

i am writing a program that keeps track of dated materials and i can query the mysql database and return all of the appropriate data that i need, take that data and fill a datagrid.  however i also need to take the data that returns create a do while loop or something similar and send out emails to the appropriate people to let them know that their contracts are expiring or needing to be renewed.  i have included the code for the email that does work.  i need help looping through this code for different email addresses different contracts etc...

any help would be greatly appreciated.

~andyStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
Public Class frmContracts
    Dim conn As MySqlConnection
    Dim data As DataTable
    Dim Adapter As MySqlDataAdapter
    Dim CommandBuild As MySqlCommandBuilder
 
 
 
    Dim t As New Timer
 
    Private Sub frmContracts_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim connStr As String
        connStr = "server=SERVER IP;user id=USER; password=PWD; database=DBTITLE; pooling=false"
        conn = New MySqlConnection(connStr)
 
        Try
            conn.Open()
            data = New DataTable
            Adapter = New MySqlDataAdapter("SELECT * FROM TABLEwhere datediff(Now(), lapsedate) > 90".ToString, conn)
            CommandBuild = New MySqlCommandBuilder(Adapter)
 
            Adapter.Fill(data)
 
            dgContracts.DataSource = data
        Catch ex As MySqlException
            MessageBox.Show("THERE US AN ERROR: " + ex.Message)
        End Try
        conn.Close()
 
end sub
    Private Sub SendEmail()
 
 
        Dim mail As New System.Net.Mail.MailMessage()
 
        Dim msgBody As String = String.Empty
 
        Dim smtp As System.Net.Mail.SmtpClient = New SmtpClient()
 
        'cycle through all matching criteria
 
        mail.From = New System.Net.Mail.MailAddress("Akeeney@lifespr.com", "Andy Keeney")
 
        mail.[To].Add("akeeney@lifespr.com")
 
        mail.Subject = "Your Contract is due for renewal"
 
        mail.Body = ""
 
        mail.IsBodyHtml = True
 
        smtp.Host = "server ip"
 
        smtp.Port = 25
 
        smtp.EnableSsl = False
 
        Try
            smtp.Send(mail)
            MsgBox("the message sent successfully")
        Catch ex As System.Exception
            MsgBox(ex.Message)
        End Try
 
end sub
[+][-]07.03.2008 at 07:42AM PDT, ID: 21925911

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio 2008, MySQL, Microsoft Visual Basic.Net
Tags: vb.net MySQL, visual studios 2008
Sign Up Now!
Solution Provided By: sl8rz
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.03.2008 at 07:43AM PDT, ID: 21925933

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628