Ultradev Example Tutorial: 3.6 Delete Records
Author:Eve Cole
Update Time:2009-05-30 18:34:42
Chapter 3: Applying Database to Create Dynamic Web Pages
Section 6: Delete records
In the previous section, we created a connection for deletion: del.asp?id=<%=(Recordset1.Fields.Item("ID").Value)%> , or make a fuss about this id.
Open the Data Bindings panel, click the "+" button, select Command (Stored Procedure), and open the Command panel. Command, as its name suggests, is to execute commands. As shown below. You can fill in the Name column in the panel as you like. It is just the name of the command we want to execute. Connection is the connection we created. Type is the operation you want to perform. Pulling down, we can see that there are four options: None, Stored Procedure, Insert, Update, Delete. We select the Delete command, and Ultradev will automatically generate code in the SQL column:
DELETE FROM
WHERE
This is still not complete. We click Tables in Database Items, select the data table we want to delete: userinfo, click the Delete button of Add to SQL on the right, and the SQL column will be automatically filled in:
DELETE FROM Userinfo
WHERE
Next we need to add qualifications, select the data table we want to delete: userinfo, select the field to qualify, here is of course the ID field, click the Where button, the SQL column changes to:
DELETE FROM Userinfo
WHERE ID =
What does ID equal? Let's add a statement manually. Click the "+" button, a blank line will be generated in Variables, fill in a name in Name, here we use del_id, and then fill in Run-time Value: request.querystring("id"). Hey, some friends saw this and asked, what does this mean? In fact, as long as you go to the item of creating a record set in the previous section of editing data, after setting the Filter, click the Advanced button, you can see the Sql statement generated by Ultradev for us, including such a request. .querystring("id"), this is equivalent to the URL Parameter in our Filter. After filling in, click OK, and our deletion page will be generated.
Because this Command panel does not provide us with an option to jump to the page, we need to add another statement. Select menu Insert -> Head Tags -> Refresh
The panel settings are clear at a glance, so I don’t need to say more :)
After adding the jump page, let us open the browser window, select the dd+dd record we just modified, click Delete Connection, and see if our record has been deleted!
The next section is about making a simple query, so please pay attention.