Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
not able to access retrieved SQL results and is going to EOF
#1
Solved: 8 Years, 4 Months, 2 Weeks ago
Hi Guys,

Can anyone please tell the solution for the following problem...

basically i have select query which retrieves the results and i want to access the rest of my QTP script based on the query results.
i have the following piece of code in my script..

Code:
Set objDB = createobject("ADODB.Connection")
objDB.open("DSN=pqrDB;uid=abcd;pwd=xyz")
strQuery = "select   top 10  * from account"
Set objResults = objDB.Execute(strQuery)
msgbox objResults.Fields.count   ' returns value as 12 and is correct
[b]msgbox objResults.Recordcount   [/b]' returns value as -1 which is wrong

[i]Do Until objResults.BOF
  strEmpName   = objResults.Fields("empname")
  strEmpCode   = objResults.Fields("empcode")
  strEmpAccount  = objResults.Fields("empaccount")
  msgbox strEmpName & " " & " "& strEmpCode & " "& strEmpAccount
   objResults.MoveNext
Loop[/i]

objResults.Close
objDB.Close

Set objResults = Nothing
Set objDB = Nothing

till 5th statement script is running fine and giving correct results.
6th stmnt i.e msgbox objResults.Recordcount is returning value as -1
and its not at all going inside the DO until loop.

since the record count is returning as -1 its going to EOF and not at all executing the DO loop.

can anyone tellme why it is returning record count as -1 and suggest me how to proceed on this and its very important for me to proceed further and need it ASAP.


Thanks
navya
Reply


Messages In This Thread
not able to access retrieved SQL results and is going to EOF - by navyasatish - 07-22-2008, 02:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  SQL Query Issue in QTP rajiv.qtp 1 2,528 11-28-2013, 10:36 AM
Last Post: Jay
  Exporting QTP runtime datatable to SQL server during SweetyChowdhury 1 3,291 05-10-2013, 03:41 AM
Last Post: sria123
  SQL on oracle database doesn't return a value Bluefields 2 3,330 07-09-2012, 01:23 PM
Last Post: Bluefields
  How to put retrieved results in an excel sheet padmini 1 3,207 09-30-2011, 09:13 AM
Last Post: rajpes
  How to fire SQL query on Excel sheet? shriqtp 6 16,764 08-06-2010, 11:39 PM
Last Post: QTPLearn

Forum Jump:


Users browsing this thread: 1 Guest(s)