The following ASP script wraps all the items in the items table in XML and also generates XML for all the bids for each item. In the Auction demo, you can click the page icon next to the CURRENT ITEMS title to see the actual XML that is received on the client.
<%@ LANGUAGE = VBScript %> <?XML VERSION="1.0"?> <AUCTION> <% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Auction","sa","" Set ItemRS = Conn.Execute("select * from item") Do While Not ItemRS.EOF %> <ITEM> <% title=ItemRS("Title")%> <TITLE><%=title%></> <ARTIST><%=ItemRS("Artist")%></> <DIMENSIONS><%=ItemRS("Dimensions")%></> <MATERIALS><%=ItemRS("Materials")%></> <YEAR><%=ItemRS("Year")%></> <DESCRIPTION><%=ItemRS("Description")%></> <PREVIEW-SMALL SRC=<%=ItemRS("Preview_small")%>/> <PREVIEW-LARGE SRC=<%=ItemRS("Preview_large")%>/> <BIDS> <% Set BidRS = Conn.Execute("select * from bids where Title equals '" & title & "' ORDER BY Price DESC") Do While Not BidRS.EOF %> <BID> <PRICE><%=BidRS("Price") %></> <TIME><%=BidRS("Time") %></> <BIDDER><%=BidRS("Bidder")%></> <TIMESTAMP><%=BidRS("Timestamp")%></> </BID> <% BidRS.MoveNext Loop %> </BIDS> </ITEM> <% ItemRS.MoveNext Loop %> </AUCTION>
Back to the XML Auction Demo overview.
© 1997 Microsoft Corporation. All rights reserved. Terms of use.