How to connect to the Database from QTP?

Answer Posted / sandipgami84

Dim ObjCon, ObjResult, ObjSQL
set ObjCon=Createobject("ADODB.Connection")
ObjCon.ConnectionString("DSN= ,UID= ,PWD= ")
ObjSQL="SELECT * FROM Emp"
ObjCon.Open()
ObjResult=ObjCon.Execute(ObjSQL)
ObjCon.Close()
ObjResult=Nothing

whtever ur data stored in ObjResult variable

Is This Answer Correct ?    31 Yes 13 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to Open FireFox using descriptive programing? If my question is not clear, i will give an Example To Open Internet Explorer, We use Set IE = CreateObject(InternetExplorer.Application) IE.Navigate "www.yahoo.com In the same i need to open yahoo.com in firefox. Can any one tell me what is the server name of firefox to create an object

2520


Why bpt?

586


RECENTLY I PLACED IN QTP..HOW TO IMPROVE VB SCRIPTS KNOWLEDGE? IAM STRUGGING TO WRITE THE AUTOMATION SCRIPTS? ANY BODY TELL HOW TO IMPROVE QTP SCRIPT SKILLS?

2169


what difference between runtime object and text object and what property they have. whether they have same properties or different properties.

1699


Hi friends I need to know about jubula automation tool. Is anybody know in bangalore where jubula tanning class is going on do let me know. Its urgent for me to learn that tool please help.

2881






can u explain relative path architecture framework in qtp?

1555


Does QTP10 supports Windows 7OS +IE 9 combination? Which is the preffered combination ,Plz let me know?

2966


Dear sir, i want to perform a QTP automated testing for mechancial engineering software like msc adams, msc nastran this softwares will help for mechanical engineering design analysis>> i know oad runner win runner, test director, QTp>> but i dont know how to use for automation

1577


When Recovery scenario actually starts while testing the application?

1532


How to capture dynamic values in load runner and how Each of the captured values are to be written to a text file (c:\temp\LoadRunner1.txt)

1727


What is debugging? How you debug your script?

602


I opened gmail login into gmail and i have to save (Pass or move) all the mail into notepad please give me code Thanks of all

1508


Pls can anyone give me the entire code for the Keyword driven framework with respect to he Flight Reservation Window in detail with explanation. Pls explain in detail stepwise. Thanks a lot. Pls very urgent?.

1511


Can QTP be used for GUI testing ?, We are using Java with MySQL and Operating system is Linux. We are NOT using the web.

1940


Why qtp always start action1 and does not start action?

596