1 <%@ LANGUAGE="VBSCRIPT" %>
2 <%
3 '-- Open connection to database
4 DB = "eCoffee.mdb"
5 Dir = Request.ServerVariables("SCRIPT_NAME")
6 Dir = StrReverse(Dir)
7 Dir = Mid(Dir, InStr(1, Dir, "/"))
8 Dir = StrReverse(Dir)
9 Path = Server.MapPath(Dir) & "\"
10 File = "eCoffee.dsn"
11 DSNa = "filedsn=" & Path & file & ";DefaultDir=" & Path & ";DBQ=" & 
   Path & DB & ";"
12 dim sql, ConnOpen, RS, RST
13 %>
14 <?xml version="1.0"?>
15 <DIALOG>
16 <%if ucase(request("YesNo")) = "N" then%>
17 <STEP NAME="init">
18 <PROMPT>Your order has been canceled. Thank you <%response.write 
   request("FirstName")%>, for using eCoffee.<BREAK SIZE="LARGE"/>
19 </PROMPT>
20 <INPUT TYPE="NONE" NEXT="eCoffee.vml#store"/>
21 </STEP>
22 <%end if%>
23 <%
24 if ucase(request("YesNo")) = "Y" then
25 '-- Insert new transaction into Transactions table
26 sql="insert into transactions (CoffeeType, CustomerNumber, Quantity) 
   values ('" & request("CoffeeType") & "'," &
   request("CustomerNo") & "," & request("CoffeeQty") & ")"
27 Set ConnOpen = Server.CreateObject("ADODB.Connection")
28 ConnOpen.Open DSNa
29 Set RS = ConnOpen.Execute(sql)
30 '-- Update available coffee quantity in CoffeeType table
31 sql = "update CoffeeType set QinStock = QinStock - " & 
   request("CoffeeQty") & " where CoffeeType ='" & 
   request("CoffeeType") & "'"
32 Set RS = ConnOpen.Execute(sql)
33 %>
34 <STEP NAME="init">
35 <PROMPT>Your order will be delivered to : <%response.write 
   request("LastName") + " " +
   request("FirstName")%> living at <%response.write 
   request("DeliveryAddress")%>. <BREAK SIZE="LARGE"/> Thank you for 
   shopping at eCoffee.<BREAK SIZE="LARGE"/>
36 </PROMPT>
37 <INPUT TYPE="NONE" NEXT="#end"/>
38 </STEP>
39 <%
40 ConnOpen.Close
41 set RS = nothing
42 set ConnOpen = nothing
43 end if
44 %>
45 </DIALOG>