0

Hi everyone.

I am currently trying to take a value from an xml file which is long and then using this as part of a soap message to update a table in a database.

The problem is that the value is not seen in the soap message.

if (record.Element("UserDefinedNum") != null)
{
  userDefinedNumberUpdate.UserDefinedNum = Convert.ToInt64(record.Element("UserDefinedNum").Value);
}

inUpdate.UserDefinedNumUpdate = new FWTUserDefinedNumUpdate[] { userDefinedNumberUpdate };

The xlm snippet has:

<UserDefinedNum>
        <long>0</long>
        <long>0</long>
        <long>0</long>
        <long>0</long>
        <long>0</long>
        <long>38081</long>
</UserDefinedNum> 

Stepping through the code I can see that:

inUpdate.UserDefinedNumUpdate[0].UserDefinedNun 38081

I would have thought that the index would be 5 not 0

Any help would be greatly arppreciated.

Edited by AquaNut: Misleading title

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by AquaNut
0

You're creating a new array each time and overwriting the previous value. This way, the array will always only contain the last value you parsed.

Try using a List and Adding to it instead.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.