The following ASP script sends back special XML updates using the timestamp that was provided by the client as a URL query parameter. The special update syntax was invented just for this demo and uses UPDATE-ACTION attributes. The client then merges these updates in with the rest of the XML, thereby avoiding having to resend all the XML each time an update is made. In the Auction demo, you can click the page icon next to the NETWORK ACTIVITY title to see the actual XML updates that are received on the client.
<%@ LANGUAGE = VBScript '-- This ASP is used to get updates timestamp = CLng(Request.QueryString("timestamp")) if timestamp > 0 then %> <AUCTIONBLOCK> <% latestTimestamp = 0 Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "Auction","sa","" Set BidRS = Conn.Execute("select * from bids3 where Timestamp > " & timestamp & " ORDER BY Price DESC") Do While Not BidRS.EOF BidTimestamp = CLng(BidRS("Timestamp")) title = CStr(BidRS("Title")) price = CStr(BidRS("Price")) if BidTimestamp > latestTimestamp then latestTimestamp = BidTimestamp end if %> <ITEM> <TITLE><%=title%></> <BIDS> <BID UPDATE-ACTION="INSERT"> <PRICE><%=price %></> <TIME><%=BidRS("Time") %></> <BIDDER><%=BidRS("Bidder")%></> <TIMESTAMP><%=BidTimestamp%></> </BID> </BIDS> <TIMESTAMP UPDATE-ACTION="REPLACE"><%=latestTimestamp%></> </> <% BidRS.MoveNext loop BidRS.Close %> </> <% end if %>
Back to the XML Auction Demo overview.
© 1997 Microsoft Corporation. All rights reserved. Terms of use.