So that takes care of adding records. Now, how about deleting them? You'll remember, from the "list" DTML Method created at the beginning of this exercise, that every item in the DVD list has links pointing to "edit" and "delete" objects, and that these objects are passed the record ID of the corresponding item. So, in other words, the "delete" object - another DTML Method - needs simply to use this ID to execute a DELETE query on the table. Let's take a look at the code for this DTML Method: No biggie. Like the "add" DTML Method before it, this one too simply functions as a wrapper for a Z SQL Method, which actually does all the work. In this case, the Z SQL Method is named "deleteMethod" and it receives a record ID as argument. Let's see what that looks like: The "deleteMethod" Z SQL Method contains a simple DELETE query, with the record ID passed to it inserted dynamically into the query template. Here's what the result page looks like: ![]()
blog comments powered by Disqus |