home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBSCRIPT" %>
- <% 'remove.asp -- Removes products from the inventory database
- '
- 'This active server page will remove products from the database
- 'which are submitted to it via the form from the displayp.asp page.
- '
- 'It demonstates the capability of ADO to execute T-SQL commands
- 'using the command object. In this case, it will be the DELETE command. %>
-
- <HTML>
- <HEAD>
- <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
- <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
- <TITLE>NIMS - Product Removed from Inventory</TITLE>
- <LINK REL="stylesheet" TYPE="text/css" HREF="nimstyle.css">
- </HEAD>
- <BODY>
-
- <%
- ' Create the first part of the T-SQL statement to be executed
- sqlcmd = "DELETE Products WHERE "
-
- 'Generate WHERE clause of the SQL command by adding all selected ProductIDs to it.
- FOR i = 1 TO Request.Form("ProductID").Count
- sqlcmd = sqlcmd & " ProductID = " & Request.Form("ProductID")(i)
- IF i <> Request.Form("ProductID").Count THEN
- sqlcmd = sqlcmd & " OR"
- END IF
- NEXT
-
- 'Reference the Session connection variable
- cn = Session("cnn")
-
- ' Create the remove command and set its properties
- Set cmd = Server.CreateObject("ADODB.Command")
- cmd.CommandText = sqlcmd
- cmd.ActiveConnection = cn
-
- ' Execute the command on the Active Connection
- cmd.Execute nRecordsAffected
-
- 'Output some feedback to the user to let them know which products
- 'were removed from the inventory database. %>
-
- <CENTER>
- <H2>Northwind Inventory Management System</H2>
- <HR>
- </CENTER>
-
- <H3>The following products have been removed from the inventory:</H3>
-
- <% FOR EACH product IN Request.Form("ProductID")
- Response.Write "Product #" & product & "<br>"
- NEXT %>
- <BR>
- <BR>
- <HR>
- Return to the <a href="default.htm">Main Menu</A>
- <BR>
-
- </BODY>
- </HTML>
-