<%@ LANGUAGE = "VBScript"%>
<%

function reportError(where, error)
  Response.Write("<font face=Arial><B>Error loading '" + where + "'</B></font> <BLOCKQUOTE><XMP>" + error.reason + "</XMP></BLOCKQUOTE>")
end function

set Doc = Server.CreateObject("Microsoft.XMLDOM")
Doc.loadXML(Request("XMLSource"))

if Doc.parseError.errorCode <> 0 then
  reportError "XMLBody", Doc.parseError
end if

Response.Write(Replace(Doc.xml, "<", "&lt;"))

set Pieces = Doc.selectNodes("//Piece")

for i = 0 to Pieces.length - 1
    Response.Write("<BR>Processing " & i)
    ID = Pieces.item(i).attributes.getNamedItem("id").nodeValue
    Artist      = Pieces.item(i).selectSingleNode("Artist").text
    Title       = Pieces.item(i).selectSingleNode("Title").text
'    Description = Pieces.item(i).selectSingleNode("Description").text

    Response.Write("<BR>" & Artist)

    Set RS = Server.CreateObject("ADODB.RecordSet")
    RS.CursorType = 2 ' dynamic cursor
    RS.LockType = 3 ' read/write
    Connection = "driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Exhibits.mdb")

    SQLString = "SELECT * FROM Pieces WHERE PieceID=" & ID
    Response.Write ("<BR>" & SQLString)
    RS.Open SQLString, Connection

    if RS.EOF then  
        Response.Write("Can't find record for piece " & Request.Form("eventid"))
    else
        RS("Artist")  = Artist
        RS("Title")  = Artist
'        RS("Description")  = Artist
'        RS.Update
    end if
    set RS = Nothing
    Response.Write("<BR>...updated")
    
next
%>