Function returns RecordSet - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Function returns RecordSet (/Thread-Function-returns-RecordSet) |
Function returns RecordSet - TestMe - 06-19-2009 Hi All, Is it possible to return a RecordSet from a function. Just like return value from function. I tried this code : ****************************** Code: Function GetData() The Function call : Code: Set RecordSet = CreateObject("ADODB.recordset") ***************************** But Im getting an error with Wrong Parameter Thanks TestMe RE: Function returns RecordSet - QTPian - 06-23-2009 Hi, You can return a record set object by using SET keyword. In your function, use Set before GetData=RecordSet Set GetData=RecordSet Hope this helps!!! RE: Function returns RecordSet - TestMe - 06-23-2009 Hi, Actually I tried this one earlier.Sry it'll not work... RE: Function returns RecordSet - QTPian - 06-24-2009 Hi, I found a solution for the problem. The following code works for me. ******************* Code: Set conn=createobject("adodb.connection") Here I have declared the connection object and recordset object globally (above the function). I have also used Set keyword infront of the function call (Set RdSt=getrs). Revert back with your thoughts on the above code. Thanks, |