how do u retrieve data from a database ? i.e. i want to
retrieve 2nd record only from a database ? write code for
this. by using ADODB connecton, RSOBJ and using a FOR loop
we can retrieve all the records( ex: if we give query as
select * from emp). but i want only 2nd record. so how to
acheive this.

Answers were Sorted based on User's Feedback



how do u retrieve data from a database ? i.e. i want to retrieve 2nd record only from a database ..

Answer / praveen

set dbobj=createobject("adodb.connection")
dbobj.provider="Microsoft.jet.oledb.4.0"
dbobj.open "<path of .mdb(msaccess)file>"

set rsobj=createobject("adodb.recordset")
QRY=select * from emp" 'for example
rsobj.open QRY,dbobj

for i=1 to 2
rec=rsobj.getrows(3,0) 'retrieve 3 records starting from 0
rec1=rec(0,i)
next

Is This Answer Correct ?    0 Yes 0 No

how do u retrieve data from a database ? i.e. i want to retrieve 2nd record only from a database ..

Answer / cheryl

I think you need to set your for loop so that it reads only
2 records or as many records from the record set that you
want. i.e for i = 1 to 2

read the next record
next

this way you have the 2nd record

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More QTP Interview Questions

What type of VB script u had done in expert view?

1 Answers  


I want to read XML file loaded in Quality center and compare the values with the values displayed in Application (web table).How can I do that

0 Answers  


What are the check points can be inserted without recording?

0 Answers  


How to get data from excel sheet to the script? write the script.

6 Answers   Ever, Liquid Hub,


What is an Regular expression doing in VBScript?Tell the pattern for the email verification.

1 Answers   Accenture,






Reverse a string keeping the words in the string as it is. E.G. "Quick Test Professional" O/P "Professional Test Quick"

5 Answers   Cap Gemini,


Explain Different types of Checkpoints in Quick Test Professional?

2 Answers   Crea,


More details about keyword driven technique in QTP

1 Answers   TCS,


1. Pls can anyone give me the descriptive programing script to find the number of edit boxes in a login window in flights reservation (windows application only not web). 2. Using descriptive programing, how do you handle changing URLs. Pls anyone, very urgent

2 Answers   Infotech,


How you will rate urself in QTP in the range of 0 to 5

0 Answers   Genpact,


What is Regular Expressions?

2 Answers  


4. How u will open the build automatically in QTP except using Systemutil.run command

4 Answers  


Categories