how to retrieve the column headers in database using
vbscript statement in QTP



how to retrieve the column headers in database using vbscript statement in QTP..

Answer / akothuru

VB Script Code to retrieve all column names

var_ConnectionString = "" 'specify the connection string
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open var_ConnectionString
Set objRecordSet = CreateObject("ADODB.RecordSet")
strSqlQuery = "select * from employee"
'Execute query and Store the results into Record set
objRecordSet.Open strSqlQuery, objConnection
For var_Loop = 0 To objRecordSet.Fields.Count - 1
colname = objRecordSet.Fields(var_Loop).Name 'column name
msgbox colname
Next

Is This Answer Correct ?    8 Yes 3 No

Post New Answer

More QTP Interview Questions

How to export data present in Datatable to an ".xls" file?

1 Answers   Crea,


Hi All, I wanted know how does QTP identifies a DataCombo. While recording I clicked on the data combo and selected a value from the list. The click of Data Combo is recorded but the selection of the value from the list is not recorded. My application is based on VB and SQL server as the database. Please let me know as how do I record the action of selecting a value from a DataCombo list. The list is being loaded from the Database Record set.

0 Answers  


How can i count the list box elements in QTP ?using script plz explain me (Chandana)

6 Answers   Wipro,


Can objects recognised without repository?

5 Answers  


Give me the Example of standard check point and text check point with syntax?

3 Answers   IMI Soft, IMI Soft Engineering,


what is the criteria for choosing test cases for automation? Ex: if you have some 300 test cases, then how many you choose for automation. what is criteria of selecting?

3 Answers   Aricent, Delhi University, TCS,


how u will describe testing activities?

2 Answers  


What are the main features we have to compulsory test by using qtp in an web based application

1 Answers  


Hi anyone having QTP 10.0 licence or crack version pls send me in this mail id mdilipkumar04@gmail.com Regards Dilip

1 Answers  


what ar the challenges do we face while testing webbased applications using the automation tool qtp or any?

4 Answers   TCS,


How should I get results when I run scripts in a Batch mode

1 Answers   TCS,


How to break the object spy ?

0 Answers  


Categories