Hi guys,
I have the following code:
VB Code:
  1. Private doc As XmlDocument
  2.     Private sNodelist As XmlNodeList
  3.     Private sNode As XmlNode
  4.  
  5.             doc = New XmlDocument()
  6.             reader = New XmlTextReader(frmSchedule.currentSchedule)
  7.             doc.Load(reader)
  8.             sNodelist = doc.SelectNodes("/schedule/visit")
  9.                 With sqlCmd
  10.                 ' loop through each visit node
  11.                 For Each sNode In sNodelist
  12.                     .CommandText = "SELECT COUNT(*) FROM visits WHERE visitID = @visitID AND sDate = @sDate"
  13.                     .Parameters.Add(New SqlCeParameter("@visitID", sNode.ChildNodes.Item(0).InnerText.ToString()))
  14.                     .Parameters.Add(New SqlCeParameter("@sDate", sNode.ChildNodes.Item(1).InnerText.ToString()))

And i was wondering whether it was possible to change the index from an integer to the name of the child node as i have another xml file that i want to use this code for but the ordering is different so using numbers is impossible.

Thanks in advance for any help. If theres any extra information you need i'll gladly provide it.