Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function returns RecordSet
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Hi, I found a solution for the problem.Cool The following code works for me.
*******************
Code:
Set conn=createobject("adodb.connection")
Set rec_set=createobject("adodb.recordset")
function getrs()
  str_con= "dsn=dsn name"
  conn.open str_con, "username", "password"
  rec_set.open "select * from table", conn, 2, 3
  Set getrs = rec_set
End Function
Set RdSt = getrs
RdSt.movefirst
msgbox(RdSt(0))
rec_set.close
conn.close
Set RdSt = Nothing
*********************

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,
Reply


Messages In This Thread
Function returns RecordSet - by TestMe - 06-19-2009, 03:49 PM
RE: Function returns RecordSet - by QTPian - 06-23-2009, 05:19 PM
RE: Function returns RecordSet - by TestMe - 06-23-2009, 05:57 PM
RE: Function returns RecordSet - by QTPian - 06-24-2009, 02:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GetRows() not fetching the exact record from the recordset Saranyaciet2 0 2,776 05-27-2015, 11:15 AM
Last Post: Saranyaciet2
  Calling a Function in Function Library when function is defined in an Action jitenderkkr 0 2,973 11-27-2014, 12:53 PM
Last Post: jitenderkkr
  Webtable().GetCellData() Returns hidden values of Cells ssvali 4 5,977 06-07-2013, 08:37 PM
Last Post: kawsar
  QTP - Webtable().GetCellData() returns unknown symbols and spaces lokesh8008 2 4,831 05-10-2013, 03:49 AM
Last Post: sria123
  Creating an array from an specific field in the recordset Arena 0 2,477 04-04-2012, 09:58 PM
Last Post: Arena

Forum Jump:


Users browsing this thread: 2 Guest(s)