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?
Danke im voraus
doch mit dem nachfolgenden Code funkt das nicht.
vlt. kann mir hier jemand helfen?
VB.NET-Quellcode
- Dim conn As OleDb.OleDbConnection
- Dim comm As OleDb.OleDbCommand
- Dim intAnzahl As Integer
- Dim booLöschen As Boolean
- Dim intCupNr As Integer
- If Group_CupNr_bekannt.Enabled = True Then
- intCupNr = T_CupNr.Text
- conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\AA\AA_Hosn_owi\bin\x86\Release\AA_Datenbankl.accdb"
- comm.Connection = conn
- comm.CommandText = "delete from Spieler where CupNr=" & T_CupNr.Text & ""
- Do
- Try
- conn.Open()
- Do
- Try
- intAnzahl = comm.ExecuteNonQuery()
- MsgBox("Anzahl Datensätze geändert: " & intAnzahl)
- booLöschen = True
- Catch ex As Exception
- MsgBox(ex.Message)
- booLöschen = False
- T_CupNr.Text = ("")
- End Try
- Loop Until booLöschen = True Or booLöschen = False
- conn.Close()
- Catch ex As Exception
- MsgBox(ex.Message)
- T_CupNr.Text = ("")
- End Try
- Loop Until booLöschen = True
- End If
Danke im voraus