sh250080
New member
- Joined
- Feb 6, 2009
- Messages
- 3
- Programming Experience
- 3-5
Hello Im making a scheduling program and I have three columns in my DB AgentName, Type, and DueBack. My DueBack Column will have a value of like 10:30 PM. Im needing to see if the Column value is the same as the System Time then it will delete the value from the DB and update the DGV> I know hwo to do everything else besides Compare and Delete. Below Ive pasted what Ive tried any help is appreciated.
I have this code in a timer and if the system time matches the Column Value it seems like it tries to add more rows and I end up with a scrollbar looking thing and it freezes until the time changes to the next minute. Im unsure what value I should for
command.Parameters.Add(New OleDbParameter("@DueBack", )) - I thought the delete but it didnt work. Any ideas?
VB.NET:
For Each row As DataGridViewRow In dgb1.Rows
Dim delete As DateTime
delete = row.Cells(2).Value.ToString
If System.DateTime.Now.ToShortTimeString = delete Then
' Dim connection As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & My.Settings.DBcon.ToString)
Dim command As New OleDbCommand("DELETE FROM type WHERE DueBack=@DueBack", connection)
' Dim row1 = System.DateTime.Now.ToShortTimeString =
command.Parameters.Add(New OleDbParameter("@DueBack", ))
connection.Open()
command.ExecuteNonQuery()
connection.Close()
adapter.Fill(dt)
dgb1.DataSource = dt
End If
Next
I have this code in a timer and if the system time matches the Column Value it seems like it tries to add more rows and I end up with a scrollbar looking thing and it freezes until the time changes to the next minute. Im unsure what value I should for
command.Parameters.Add(New OleDbParameter("@DueBack", )) - I thought the delete but it didnt work. Any ideas?