write a VBscript code to parametrize test script using test
data from sqlserver database?

Answers were Sorted based on User's Feedback



write a VBscript code to parametrize test script using test data from sqlserver database?..

Answer / kamesh n

first connect to database using the following script


set sqlconnection=createobject("ADODB.connection")
set sqlrecordset=createobject("ADODB.recordset")

To open the connection

sqlconnection.open "You have to mention your database
connection string"

sqlrecordset.open "Give your query",sqlconnection

to run through all the records

if not sqlrecordset.EOF then


suppose your are going to set it to a textbox then

Browser(browsername).page(pagetitle).webedit
(testboxname).set sqlrecordset(columnname)


end if

Is This Answer Correct ?    8 Yes 1 No

write a VBscript code to parametrize test script using test data from sqlserver database?..

Answer / rajh

dim con,rec
set con=create object("adodb.connection")
set rec=create object("adodb.recordset")
con.open"provider=sqloledb.1;server=name;username=scott;pwd=tiger;database=dbname'
rec.open"sql statement"con
while not rec.eof
window("winmame").winedit("uname").set rs.fields(un)
in the same way use the data
loop

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More QTP Interview Questions

We have a text file which contains 1 to 100 numeric values sequentially like 1 2 . . 100 Now we have to count them and transfer to XML file by writing a code in qtp.

1 Answers   Cap Gemini,


Can the user toggle between using Local OR and shared OR for the same action?

0 Answers  


How to retrieve value (data) from notepad using QTP ?

5 Answers   Health Care,


How you can replace string in qtp?

0 Answers  


hai friend's .. my question is a[0]=I a[1]=N a[2]=D LIKE IT GO'S i need output INDIA ,using simple string how will u do? can any one tell really need full..

4 Answers   Mind Tree, Tech Mahindra,






How to retrieve the data from database?

6 Answers   Wipro,


Can we do qtp testing without creating objects in Dbject repository? can we do it completely writing code i.e in expert view only. Are there any books for this?

7 Answers   Accenture,


How to "Turn Off" QTP results after running a Script?

3 Answers   Crea,


How can we make a shared object repository in QTP 9?

3 Answers   Kanbay, Ordain Solutions,


How do i relate the checkbox properties with webelement when checkbox properties are changing on every login to the application

1 Answers   TCS,


how do u handle an object without name using QTP 9.2?

0 Answers   CTS,


The Senario is Steps to do 1.Entered userid in textbox 2.saved with details 3.i want to open user which i have created its in hurry.....

1 Answers  


Categories