First thing I would suggest
Quote:
del = "DELETE FROM " + databaseName + " WHERE Id = (SELECT MAX(Id) FROM " + databaseName + " )";
put a breakpoint on this line and inspect what value del has assigned to it.
I am going to guess that you are trying to delete incorrectly as you are inputting the
database name rather than the table that you need delete from.