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.

Recommended Answers

All 2 Replies

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.

Thanks Ketsueliame, I'll give that a go.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.