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 many types of recording modes in the qtp?

0 Answers  


Question:how many types of repositories in QTP9.2?and explain??

3 Answers  


how to write regular expression for Date field?

12 Answers   Google,


I am trying to read the rediffmail usign the below code. But facing problem, while i user to get the link of the mail, i am getting all the link of the page, While i just want to get only mail name - link (not all the link of an page) so that i able to read the mail message by clcking on them in qtp. Dim Lnk,Webcheckbox Set Lnk= Description. Create '********* To count and display the webcheckbox Lnk("micclass" ).value=" Link" set LinkName= Browser("Welcome to Rediffmail:" ).Page("Welcome to Rediffmail:" ).ChildObjects( Lnk) LinkCount=LinkName. Count msgbox LinkCount For i=1-1 to LinkCount-1 DataTable.SetCurren tRow(i) DataTable.Value( "Name",1) =LinkName( i).GetRoProperty ("name") Next Waiting for the reply Praveen Saini

1 Answers  


what is input pramater out output pramater ?i want the decrepation..?how to use in QTP?

3 Answers   Infinite Computer Solutions,






What is test object model in QTP ?

8 Answers  


Which features or drawbacks of QTP lead to the upgrade for a newer version?

0 Answers  


As u told write Libarary files in QTP. Do u use ever oject repositary 0r spy while writing scripts and for which type of testing u prepared test scripts.

1 Answers  


What is object spy in quicktest professional (qtp)?

0 Answers  


Explain how you can find length of array in qtp?

0 Answers  


What is diff. between ordinal identifier INDEX and Location?

3 Answers  


How many ways we can parameterize data in QTP?

2 Answers  


Categories