[OleDB] Daten in MS Access ändern (UPDATE)

Dim DB_OleDBCommand As New System.Data.OleDb.OleDbCommand
Dim sSQL As String
Dim sDecimalSeparator As String = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator

Try
    DB_OleDBCommand.Connection = frmMain.DB_OleDBConnection

    sSQL = "UPDATE Users SET Name='" & tbName.Text & "', " & _
    "Weight=" & tbPower.Text.Replace(sDecimalSeparator, ".") & ", " & _
    "WHERE ID=" & Me.Tag.ToString

    DB_OleDBCommand.CommandText = sSQL
    DB_OleDBCommand.ExecuteNonQuery()
    DB_OleDBCommand.Dispose()
    DB_OleDBCommand = Nothing
Catch ex As Exception
    MessageBox.Show("Fehler: " & ControlChars.CrLf & ex.ToString())
End Try

Schreibe einen Kommentar