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

Explain Descriptive Programming Types with Examples?

0 Answers  


Hi, I Would Like to Know which is the Best QTP Certification Training Institute in Hyd? Thanks in Advance kishan

1 Answers  


How open an excel sheet in QTP(not a run time )?

4 Answers   Tech Mahindra,


what is compiled module?

1 Answers  


Does quicktest professional is unicode compatible?

0 Answers  






how to create user defined functions in QTP? can any one expalin me with example.. Thanks in Advance for help

4 Answers  


What are the enhancements u did after recording ur script?

3 Answers  


WHO IS THE BEST FACULTY FOR QTP IN HYDERABAD? A) NAGESHWAR RAO- MINDQ B) SURESH REDDY -SMART SOLUTIONS C) SURESH BABU- Q EDGE D) VENKAT - LIVE TECH E) GC.REDDY - HI-TECH CITY F) NONE OR OTHERS

7 Answers  


Hi Friends, Can any one answer this question? 17) What method is used to retrieve the number of columns in the query results? A. Fields.Count B. Fields.Item(EOF) C. Fields.Count(BOF) D. Fields.Count.Value

2 Answers  


how to get the object property

4 Answers   Covansys,


wt is memory leakage?

6 Answers   BSL,


Hello, I am facing problem to check textpoint for mercury application . I have inserted checkpoint to check flight summary for place of departure and arrival with datatable and script look like "Browser("Find a Flight: Mercury").Page("Book a Flight: Mercury").Check CheckPoint("Book a Flight: Mercury_4")" but while I am executing this script at last my check point gets fail and display Text Checkpoint: captured "" between Summary and 4/31/2008FLIGHT , expected "Acapulco" Match case: ON Exact match: OFF Ignore spaces: ON I think value from data table is not fatched so please guide me what I have to do to overcome this problem.. Thanks

0 Answers  


Categories