Hi
Hope someone can help.
I have an Access database with 3 columns. (FirstName, LastName and EndDate)
I am trying to create a button that will delete all records in the database that is older than the current date. Today()
Any help would be appreciated.
Is this possible?
Here is what I have so far:
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=C:\Database1.mdb")
Dim cmd As OleDbCommand = New OleDbCommand("SELECT LastName, FirstName, EndDate FROM Table1 WHERE EndDate < NOT SURE WHAT TO DO HERE", con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "Table1")
Table1DataGridView.DataSource = myDataSet.Tables("Table1").DefaultView
End Sub
Hope someone can help.
I have an Access database with 3 columns. (FirstName, LastName and EndDate)
I am trying to create a button that will delete all records in the database that is older than the current date. Today()
Any help would be appreciated.
Is this possible?
Here is what I have so far:
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=C:\Database1.mdb")
Dim cmd As OleDbCommand = New OleDbCommand("SELECT LastName, FirstName, EndDate FROM Table1 WHERE EndDate < NOT SURE WHAT TO DO HERE", con)
con.Open()
Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd)
Dim myDataSet As DataSet = New DataSet()
myDA.Fill(myDataSet, "Table1")
Table1DataGridView.DataSource = myDataSet.Tables("Table1").DefaultView
End Sub