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

Hi all, i have installed QTP8.2 in my system. but script is not generating while recording. What is the problem? is any file missing? pls let me know anybody...Thnaks

3 Answers  


Can we put more than one action in a single script???? yes or no.....

2 Answers   BirlaSoft,


What is driver script and driver script in qtp frame work????

6 Answers   IBM,


Is QTP a compiler or interpreter..? can you we execute a QTP Script file in a another system which does not have QTP installed..??

6 Answers   Virtusa,


Hi, Is there any function or vbscript in QTP to clear the cookies,sessions. Please help me in this.

6 Answers  






how to count the word "IS" is repeated in the application using DP

3 Answers   DST Global Solutions,


I have test cases in excel sheet but i am using quality center.How can i copy the testcases from excel sheet to quality center?explain this process.

3 Answers   TCS,


How to display the first 3 letters in these "ABCDEFGH" using qtp script?

6 Answers   Oracle,


X=10,Y=20 you need to swap the numbers without using a third variable?

5 Answers  


What is object spy in quicktest professional?

0 Answers  


Does QTP run in any environment?

0 Answers  


In a webpage how to check the dynamic links that re changing regularly?( without using regular expressions.)

3 Answers   Misys,


Categories