RodT Posted June 13, 2008 Posted June 13, 2008 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!
DarkMatter Posted June 13, 2008 Posted June 13, 2008 Yes it would. [sub]Quantum mechanics: The dreams stuff is made of[/sub]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now