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
Explain how qtp identifies object?
How to add synchronisation points in qtp?
What are the types of object repositories? Which one is you using?
what difference between runtime object and text object and what property they have. whether they have same properties or different properties.
Is text area check point supports for web applications?
Sql questions to find second max salary and how to use joins
i have two questions for regular expression :- Q1. I have date pattern eg-29/11/2011 29-11-2011 29.11.2011 Que- if any separator is there between date,month and year pattern should match else it should not match eg- pattern should not match in case of 2911-2011 Q2. let say i have a string and there is a number in between of that string eg.-Amount 30002.234 successfully credited to your account . now i have to match this pattern in such a way that even if decimal is not there pattern should match ,how i will do this using regular expression
What is the quicktest professional testing process?
I am sathish , i want to test the Application of JIL.org ,Mobile Emulator ,by using QTP10.0. I am trying to do testing on that Application , but Child Objects are not identified by the QTP. Please can any one help me
How to use the object spy in quicktest professional 8.0 version?
How to analyzing test results using quicktest professional?
In Test Directory, What are the contents in test case designing? if you prepare in excel sheet how u use thrw Test Directory?
images are dynamically changes how to compare two images with out using the bitmap
What is optional step in qtp? How you can add optional step in qtp?
what is error and fault in terms of software quality?