Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Database

Show a list of customer orders

Scroll Prev Next More

 

Show a list of all orders placed by the current customer on the Order Edit page.

 

Insert ASP code snippet on the Page Designer screen:

 

dim rstmp, CustomerID, rsOrders
set rstmp = dal.Table("orders").Query("OrderID=" &
request.querystring("editid1"),"")
 CustomerID = rstmp("CustomerID")
 rstmp.Close : set rstmp = nothing
 response.write "Orders placed by " & customerid & "<br>"
set rsOrders = dal.Table("orders").Query("customerid='" & customerid & "'","")
 
do while not rsOrders.eof
   response.write "<a target=_blank href=Orders_edit.asp?editid=" &_
 rsOrders("OrderID") & ">" & rsOrders("OrderID") & "</a> " &
rsOrders("OrderDate") & "<br>"
   rsOrders.MoveNext
loop
 rsOrders.Close : set rsOrders = nothing

 

See also:

Data Access Layer

QueryResult object fetchAssoc()

Database API

Master-details relationship between tables