PDA

View Full Version : Function returning an array


codefox
01-08-2003, 01:34 PM
This function returns an array created locally within the function
Function GetSQLErrorClear(ByRef oDBCon)
ReDim asSQLCodes(oDBCon.Errors.Count - 1)
Dim iNextError ' Used to index the array of SQL error codes

' Get all SQL errors
For iNextError = 0 To UBound(asSQLCodes)
asSQLCodes(iNextError) = oDBCon.Errors(iNextError).SQLState
Next

oDBCon.Errors.Clear
GetSQLErrorClear = asSQLCodes
End Function

Now, if I call this function as
asSQLErrors = GetSQLErrorNoClear(oDBCon)
it works fine. But how exactly is the return value assigned? Is the array (local to the function GetSQLErrorClear) copied to the array in the page calling the function or its reference copied?