0

Sub DeleteRecords()

Dim qry As String = "SELECT * FROM Attendance"
Dim daTestTbl As New OleDbDataAdapter(qry, con1)
Dim cbTestTbl As New OleDbCommandBuilder(daTestTbl)
Dim dtTestTbl As New DataTable("Attendance")

Try
    daTestTbl.Fill(dtTestTbl)

    For Each dr As DataRow In dtTestTbl.Rows
        dr.Delete()
    Next

    daTestTbl.Update(dtTestTbl)
    dtTestTbl.Dispose()
    daTestTbl.Dispose()
Catch ex As Exception
    MsgBox(ex.Message)

End Try

An error always pops up when running the program. May I have some help?

This is the error

Dynamic SQL Generation for the delete command is not supported against a Select Command that thus not return any key column information.

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.