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
How many ways is to parameterize the value?
Where is the Bitmap checkpoint information stored?
if mandatory and Assitive propertys are shows same how will u write skript in QTP window
What is recovery scenario manager? When you go for recovery scenario manager? Tell me one scenario were your used recovery scenario in your project?
Explain the differences between table and db checkpoints?
Why is action split used by qtp?
In qtp, how you can remove the spaces from string?
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
How to use checkpoints in qtp ?
Where you get the run time data table?
Can anyone tell me how i used QTP 9.2 use for GIS based S/w with an example?
What are the features of quick test pro(qtp)?
In application which areas to be automated and what kind of situation will be take? using QTP? Plz give me the clear answer
Explain sub procedure of vbscript.
tell me exact differenceb bw qtp and selenium?(could not tell open soure and licennce? difference in usage and technical difference?