i have 2 strings: a value in an array and a variable from some xml.
I need to numeriaclly add them together, as they are both strings, using + doesn't work. I have tried cStr but it errors
what do I do?
cheers
monkey
| SitePoint Sponsor |
i have 2 strings: a value in an array and a variable from some xml.
I need to numeriaclly add them together, as they are both strings, using + doesn't work. I have tried cStr but it errors
what do I do?
cheers
monkey
monkey - the rest is history
Just tried adding 1 to one of the values and then minus 1 of the end, but it appears it an xml error. I have:
myVar=(xmlDoc.selectSingleNode("DataReturn/DataBatch").xml)
myNum=myArray(0) + myVar
but the page seems to always read the xml value fresh, rather then just setting myVar to the value of DataBatch - how can i sort this?
cheers
monkey
monkey - the rest is history
try with &
string3 = string1 & string2
& is for concatenation not addition
monkey - the rest is history





xmlDoc.selectSingleNode("DataReturn/DataBatch").xml
is not a number, its a string representation of the node, so it's likely to be something like
"<DataBatch>22</DataBatch>"
or maybe even
"<DataBatch>22<childNode>somevalue</childNode></DataBatch>"
Try
CDbl(xmlDoc.selectSingleNode("DataReturn/DataBatch").text)
to return a numeric value of what's contained in some node
Don't forget to use Response.Write(thingie) if you're not sure about what (thingie) contains.
I also suggest you install the documentation from the latest MSXML object and refer to that!





CLng()
CDbl()
CInt()
???





I used CDbl because it'll work regardless of whether the number has decimals or not.
superstars!!!!
I am booked onto a course, so hopefully I will be able to learn a lot from that and stop asking what are probably stupid question!![]()
cheers
monkey - the rest is history










Huh, we keep doing that today.look at the post timestamps
Bookmarks