Sign in to follow this  
Followers 0
RodT

Can my Function create & return an array?

2 posts in this topic

Can I write a function which creates and returns an array, without the array going out of scope when the function returns? It would look something like this:

Func GetDBRecord(ByRef $con)

Local $rec[3]

Local $rs = ObjCreate("ADODB.Recordset")

$rs.Open("select * from table", $conn)

$rs.MoveFirst()

$rec[0] = $rs.Fields(0).Value

$rec[1] = $rs.Fields(1).Value

$rec[2] = $rs.Fields(2).Value

Return $rec

EndFunc

$myrec = GetDBRecord($con)

Would $myrec be valid and still in scope?

Thanks!

Share this post


Link to post
Share on other sites



Yes it would.


[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0