Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to connect to the Database from QTP?

Answer Posted / ss

Dim objConnection
'Set Adodb Connection Object
Set objConnection = CreateObject("ADODB.Connection")
Dim objRecordSet

'Create RecordSet Object
Set objRecordSet = CreateObject("ADODB.Recordset")

Dim DBQuery 'Query to be Executed
DBQuery = "Select NAME from dbo.EMPLOYEE where AGE = 29"

'Connecting using SQL OLEDB Driver
objConnection.Open "Provider=sqloledb.1;Server=.SQLEXPRESS;User Id=sa;Password=Password123;Database=Trial"

'Execute the Query
objRecordSet.Open DBQuery,objConnection

'Return the Result Set
Value = objRecordSet.fields.item(0)
msgbox Value

' Release the Resources
objRecordSet.Close
objConnection.Close

Set objConnection = Nothing
Set objRecordSet = Nothing

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many ways is to parameterize the value?

1075


Where is the Bitmap checkpoint information stored?

2247


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

2021


What is recovery scenario manager? When you go for recovery scenario manager? Tell me one scenario were your used recovery scenario in your project?

974


Explain the differences between table and db checkpoints?

941


Why is action split used by qtp?

922


In qtp, how you can remove the spaces from string?

917


If there is a change in the object type eg: A button is changed as link, 1. How to edit that in the shared object repository. 2.What options are available to edit the object within shared object repository other than copy from loca; 3.What would be the effect of the change in Coded Scripts within QTP and Functions stored in .vbs file which are loaded and used in QTP

1687


How to use checkpoints in qtp ?

952


Where you get the run time data table?

971


Can anyone tell me how i used QTP 9.2 use for GIS based S/w with an example?

2175


What are the features of quick test pro(qtp)?

942


In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer

2343


Explain sub procedure of vbscript.

985


tell me exact differenceb bw qtp and selenium?(could not tell open soure and licennce? difference in usage and technical difference?

2102