Click to See Complete Forum and Search --> : Looping logic problem


dave-g-o
October 19th, 2006, 06:01 AM
hi, sorry this is ASp not ASP.NET but I couldnt spot an ASP forum

my problem is fairly simple - but i seem to be struggling on the logic I have an asp page which reads an XMl file and processes the node contents into a DB, - this works fine so I have added some validation which will first check to see if the record already exists. This is by using a while not record set.EOF loop to determine if a date value for that particular record is in the DB - and if it is not to add the contents of the xml file.

[CODE]

<% cSYS_NOBOTTOMFRAME="1" %>
<!--#include file="../proquis.inc"-->
<!--#include file="../adovbs.inc" -->

<%

'open pre saved xml file
Set xmlDoc1 = Server.CreateObject("Msxml2.DOMDocument")
xmlDoc1.async = False
xmlDoc1.validateOnParse = False
xmlDoc1.resolveExternals = False
xmlDoc1.Load Server.MapPath("../temp/newAppointment.xml")


'assign xml values to variables

Set nodes = xmlDoc1.selectNodes("//NEWAPPOINTMENTS/APPOINTMENTS")

SET ORS = PRQCreateRS ("SELECT * FROM CALENDAR WHERE ANUM = -1", 2,3,3)

while not ORS.EOF

if ORS ("STARTDATETIME") <> node.selectSingleNode("START").nodeTypedValue then

For Each node In nodes
writeDebugCode("sds")


ORS.ADDNEW

If Not(node.selectSingleNode("START") Is Nothing) Then
ORS ("STARTDATETIME") = node.selectSingleNode("START").nodeTypedValue
End If

If Not(node.selectSingleNode("END") Is Nothing) Then
ORS ("ENDDATETIME") = node.selectSingleNode("END").nodeTypedValue
End If

If Not(node.selectSingleNode("SUBJECT") Is Nothing) Then
ORS ("CALCOMMENT") = node.selectSingleNode("SUBJECT").nodeTypedValue
End If

If Not(node.selectSingleNode("BODY") Is Nothing) Then
ORS ("CALNOTES") = node.selectSingleNode("BODY").nodeTypedValue
End If

If Not(node.selectSingleNode("PERSNO") Is Nothing) Then
ORS ("PERSNO") = node.selectSingleNode("PERSNO").nodeTypedValue
End If

ORS.MoveNext
next
end if
ORS.MoveNext
wend

ORS.UPDATE
PRQKillRS(ORS)
set ORS = nothing




Set objFso = Server.CreateObject("Scripting.FileSystemObject")
objFso.DeleteFile Server.MapPath("../temp/newAppointment.xml")
Set objFso = Nothing



%>

[CODE]

this works fine withint the EOF loop but with this loop it dosent work and nothing is put into the DB, please help if you can, much aprechiated.