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

How to get data line by line from web element

2 Answers  


Can anybody give the script to addsheet, add column,add values under that column in the rows??

5 Answers   AZTEC,


Wht is Smart Identification Mechanisam in QTP..Actually when do we this Technology means during Recording or running ....how is technology works. Anybody can expalin this .....Thanks in advacne

4 Answers   Siemens,


can we install qtp on server machine and do automation of application which is installed on client machine.If yes then how? If no then is there any other automation tool for this (client-server) senario.

4 Answers  


Suppose you are using shared objects repository in your test and you want to split your present action? At that time shared object repository is single or it’s also splits?

0 Answers  






Why is action split used by qtp?

0 Answers  


How to find if given number is prime or not

1 Answers  


if mandatory and Assitive propertys are shows same how will u write skript in QTP window

0 Answers   Wipro,


what is output value in QTP and how it can be used in automation testing

0 Answers  


in Qtp,how to display user name and pwd (script)in data table(global sheet).

2 Answers  


what happen in object repository(shared)if we call an existing action from an external action ? and what happen in object repository(peraction)if we call an existing action from an external action ?

2 Answers   Covansys, Systel,


write script for how to add function library in QTP

2 Answers   Aspire,


Categories