I want to compare a date in a database to today's date and it they are equal. Display the contents of the related date in the database in datagridview on a new form.
This is my code
Private Sub TimerAppoint_Tick(sender As Object, e As EventArgs) Handles TimerAppoint.Tick
Dim TheDate As String = Now.ToString(" MMMM dd yyyy")
Dim con As New OleDbConnection
Dim cmd As New OleDb.OleDbCommand
cmd = New OleDbCommand(Command, con)
con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("Patients")
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter("SELECT AppDate AS Expr7 FROM Appointments", con)
da.Fill(dt)
For Each DataRow In dt.Rows
If (TheDate - 1) = (AppDateDateTimePicker.Text = DataRow(0)) Then
appoint.Show()
appoint.AppointmentsDataGridView.Show()
con.Close()
Return
End If
Next
con.Close()
Return
End Sub
ZIPB 0 Newbie Poster
artemix22 4 Newbie Poster
M.Waqas Aslam 67 Posting Pro in Training Featured Poster
ZIPB 0 Newbie Poster
RH-Calvin -2 Junior Poster in Training
shann_ 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.