Advertisement
Advertisement
| 07.03.2008 at 07:13AM PDT, ID: 23536900 |
|
[x]
Attachment Details
|
||
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
|