How do you know that record A in the DB comes from file B that you're foreach loop is processing? That is the query you need to write, based upon your rules. Once you have that query put it into your SQL task as the WHERE clause of your DELETE command. Example (where you're using a parameter provided by SSIS task to specify the filename).
DELETE FROM MyTable WHERE FileName = @filename