hi all,
I have a performance question.
Sometimes I write a function that returns an object, but I don't always call it and use the returned object, what really happens here?
Example:
Sometime I call it as follows.VB Code:
Public Function ExecuteSQL (ByVal sSQL As String) As Recordset Set ExecuteSQL = myConn.Execute (sSQL) End Sub
In the above call, the function ExecuteSQL creates an instance of a Recordset in the calling function scope, then puts a pointer to that object in rsTemp, am I right?VB Code:
Dim rsTemp as Recordset Set rsTemp = ExecuteSQL ("Select * From Table1")
Now, what happens if I just call it like this:
VB Code:
ExecuteSQL("Insert Into Table1 (Field1, Field2, Field3) Values (""TestField1"", ""TestField2"", ""TestField3"")")
will the ExecuteSQL function still create an instance of a Recordset in the calling function scope? If so, is it better to create to versions of that function, one a Function and the other a Sub?




Reply With Quote