What do you get when you combine the fast deleting interface of our
image killing script with the database code from our record deleting
sample? A script that helps you weed out those unwanted database
records in the blink of an eye.
This is basically a version of our DB Delete script
on steroids. This version lets you delete a bunch of records in one call to the page.
Please note that this is sample code. As such, there is no "Are you sure you
want to delete?" step. When you hit delete the records are gone...
no recycling bin... no undelete... they are gone. Please take a moment to
ponder this fact before you use this code against any data that you care about
and please always make a backup!
This sample is running off of our SQL Server, but a copy of the database in
Access format is available for download here.
I've gotten a number of requests for us to add a delete confirmation step to
this script. While you could add another post back to the server and do a confirmation
style of confirmation and causes less work for the server. I've added a simple
version that just asks "Do you really want to delete the selected records?"
to this page. It's nothing fancy, but it should work in most current browsers. I've tested
it in IE and Firefox. If you run across a browser in which it doesn't work just
let me know and I'll try and get it fixed.
If you don't like the confirmation step, you can eliminate it by simply removing the
onsubmit attribute of the form.
For those of you that are looking for a little more sophisticated version, I also
whipped up a version that includes the ids of the records to be deleted in the confirmation
dialog box. It's a little more complex and probably more likely to break in non-standard
browsers, but once again I did test it in IE and Firefox so you shouldn't have any issues
with those. If you'd like to take a look at it the advanced version can be found here: