07-22-2008, 02:26 AM
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..
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
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