DBPix Sample Source Code: get_item_xml.asp Back to sample
<% @ LANGUAGE=VBScript %>
<% Option Explicit %>
<!--#include file="config.inc" -->
<!--#include File="adovbs.inc"-->
<%
Response.Buffer = TRUE
Response.Expires = 0
Dim rs
Dim SQL
Dim ItemId
Dim xmlDoc
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = adUseClient
ItemId = Request("itemid")
If (ItemId <> "") Then
SQL = "SELECT tItems.* " &_
"FROM tItems " &_
"WHERE tItems.Id = " & ItemId
rs.open SQL, GetConnectString, adOpenKeyset, adLockBatchOptimistic
Set rs.ActiveConnection = Nothing
If (ItemId = "0") Then
rs.AddNew
rs("ImageVersion") = 1
rs.Update
End If
if NOT (rs.EOF AND rs.BOF) then
Response.ContentType = "text/xml"
Set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
'Persist the Recorset in XML format to the DOMDocument object.
rs.Save xmlDoc, adPersistXML
'Write out the xml property of the DOMDocument object to the client Browser
Response.Write xmldoc.xml
end if
rs.Close
end if
Set rs = Nothing
Response.End
%>
Back to sample
|