|
-
Jul 29th, 2020, 05:52 AM
#1
Thread Starter
New Member
How can I set an event using the data from a SQL database
Hi all
I have written simple programs that show in DataGridView some info. The most important info is the expiration date , which I manage to color it read when the expiration date is near(like 5 days). The person responsible has an email in the database. I use a SQL database. What is the code to send email only to the persons that their products are near the expiration date? If I call the function send_mail() in the code that colors the line red it sends infinite mails to 1 person. This is my code:
Private Sub dgvExcel_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
If CDate(DataGridView1.Rows(e.RowIndex).Cells(DataGridView1.Columns(5).Index).Value) <= Date.Now Then
e.CellStyle.BackColor = Color.Red
'send_mail()
End If
If CDate(DataGridView1.Rows(e.RowIndex).Cells(DataGridView1.Columns(4).Index).Value) <= Date.Now Then
e.CellStyle.BackColor = Color.White
e.CellStyle.ForeColor = Color.Black
End If
End Sub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|