We help IT Professionals succeed at work.

Help with Expression must evaluate to a node-set. error message

vcharles
vcharles asked
on
Hello,
I am getting eror message : Expression must evaluate to a node-set.
On line: For Each xnLink As Xml.XmlNode In xdLink.SelectNodes("/Root/LinkA/[Receiver_ID='" & C1Receiver.SelectedItem.Value & "']")

I am passing ID values from the C1Receiver DropdownList (for example 2) and xdLink loads a file in the following format:

<Root>
  <LinkA>
    <LinkAID>1</LinkAID>
    <Receiver_ID>1</Receiver_ID>
    <CountryOrigin_ID>1</CountryOrigin_ID>
    <CountryUser_ID>1</CountryUser_ID>
     </LinkA>
<LinkAID>2</LinkAID>
    <Receiver_ID>2</Receiver_ID>
    <CountryOrigin_ID>4</CountryOrigin_ID>
    <CountryUser_ID>3</CountryUser_ID>
     </LinkA>
</Root>

Can you please help me fix this error.

Thanks,

Victor
Comment
Watch Question

Most Valuable Expert 2011
Top Expert 2015
Commented:
Try this instead:

For Each xnLink As Xml.XmlNode In xdLink.SelectNodes("/Root/LinkA[Receiver_ID='" & C1Receiver.SelectedItem.Value & "']")

Open in new window

Author

Commented:
Thanks!