Datensatz aus Access 2007 Tabelle löschen

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von INOPIAE.

    Datensatz aus Access 2007 Tabelle löschen

    Hi ich versuche einen Datensatz aus einer Access 2007 Tabelle zu löschen.

    doch mit dem nachfolgenden Code funkt das nicht.

    vlt. kann mir hier jemand helfen?

    VB.NET-Quellcode

    1. Dim conn As OleDb.OleDbConnection
    2. Dim comm As OleDb.OleDbCommand
    3. Dim intAnzahl As Integer
    4. Dim booLöschen As Boolean
    5. Dim intCupNr As Integer
    6. If Group_CupNr_bekannt.Enabled = True Then
    7. intCupNr = T_CupNr.Text
    8. conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\AA\AA_Hosn_owi\bin\x86\Release\AA_Datenbankl.accdb"
    9. comm.Connection = conn
    10. comm.CommandText = "delete from Spieler where CupNr=" & T_CupNr.Text & ""
    11. Do
    12. Try
    13. conn.Open()
    14. Do
    15. Try
    16. intAnzahl = comm.ExecuteNonQuery()
    17. MsgBox("Anzahl Datensätze geändert: " & intAnzahl)
    18. booLöschen = True
    19. Catch ex As Exception
    20. MsgBox(ex.Message)
    21. booLöschen = False
    22. T_CupNr.Text = ("")
    23. End Try
    24. Loop Until booLöschen = True Or booLöschen = False
    25. conn.Close()
    26. Catch ex As Exception
    27. MsgBox(ex.Message)
    28. T_CupNr.Text = ("")
    29. End Try
    30. Loop Until booLöschen = True
    31. End If


    Danke im voraus