Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable going out of scope

Status
Not open for further replies.

pdbowling

Programmer
Mar 28, 2003
267
US
Hello, Everyone.

I have a variable that I am setting from a recordset.
It is going out of scope after I close the recordset, and I don't understand why.
I am setting a variable to the recordset value in order to avoid just this situation. Why would the variable go out of scope? Is java not strongly typed? It seems to be setting the variable as a reference.

Code:
  var bill=icurs("billto") 

  Write("<br>" + icurs("billto") +"<br>")
  Write("<br>" + bill +"<br>")


  Write("<br>1 Hello<br>")
  Write("<br>" + bill +"<br>")
  Write("<br>1 Goodbye<br>")

  icurs.close()

  Write("<br>2 Hello<br>")
  Write("<br>" + bill +"<br>")
  Write("<br>2 Goodbye<br>")

This is the output.

Code:
ABC
ABC

1 Hello
ABC
1 Goodbye

2 Hello

2 Goodbye

Is there a different declaration to force 'by value'?
 
Try
Code:
var bill=icurs("billto") + "";
 
are you sure this is javascript? js normally has line terminators, and this has none.

if it is js then you have probably retyped your code in to the code box here. don't do that. cut and paste the precise code you are using to be certain there are no transposition errors or omissions.

also post the icurs class. it is possible that the close method (or a method in close) is altering the global variable 'bill'.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top