how to retrieve data from
flight resevation->reports
Answers were Sorted based on User's Feedback
Answer / manjunathareddy
Set oExcel=CreateObject("Excel.Application")
oExcel.Visible=True
Set oBook=oExcel.Workbooks.Add
Set oSheet=oBook.Worksheets(1)
Set Con=CreateObject("ADODB.Connection")
Con.Open("QT_Flight32")
Set RsObj=Con.Execute("Select * From Orders")
total=RsObj.Fields.Count
Do until RsObj.EOF
j=j+1
For i=1 to total - 1
oSheet.Cells(j,i+1).Value=RsObj.Fields(i).Value
Next
RsObj.MoveNext
Loop
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / jegan
''Connect to the DataBase
Function getConnection ()
On Error Resume Next
Dim oConnection, oConnectionString
'oConnectionString = "Provider=SQLOLEDB; Data
Source=192.168.10.104; Initial Catalog=UASC; User
Id=developer; Password=tiger!@;"
oConnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Program Files\HP\QuickTest
Professional\samples\flight\app\flight32.mdb; User Id=admin;
Password=;"
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Open oConnectionString
Set getConnection = oConnection
End Function
'Check that database connected or not
'Dim MyConnString, MyConnection
'Set MyConnection = getConnection
'If MyConnection.Errors.Count = 0 then
' msgbox "Database Connected"
'Else
' msgbox Err.Description
'End If
''Retrieve DB Records
Function getRecordset (strSQL)
On Error Resume Next
Dim oConnection, oRecordSet
Set oConnection = CreateObject("ADODB.Connection")
Set oRecordSet = CreateObject("ADODB.Recordset")
oConnection = getConnection()
oRecordSet.Open strSQL,oConnection,adOpenStatic
Set getRecordset = oRecordSet
End Function
''Get recordset
Set MyRecordset = getRecordset ("Select * from Orders" )
''Get number of columns in table
nColumns = MyRecordset.Fields.Count
''Add a sheet in your datatable
Datatable.AddSheet ("DBImport")
For n = 0 to nColumns-1
''Get column name
ParamName = MyRecordset.Fields(n).Name
''Add DTParameter
Datatable.GetSheet("DBImport").AddParameter
ParamName, ""
nRow = 1
MyRecordset.MoveFirst
''Retrieve and place data in data table
Do while MyRecordset.EOF <> True
Datatable.SetCurrentRow(nRow)
Datatable(ParamName,"DBImport") =
MyRecordset.Fields(ParamName)
nRow = nRow + 1
MyRecordset.MoveNext
Loop
Next
Is This Answer Correct ? | 0 Yes | 0 No |
What are the check points can be inserted without recording?
What is parameter in qtp?
I came across Good question ..... Write a script to only download pdf's if there are 20 links on a page. Kindly reply these type of questions are pretty challenging..
Explain measuring transaction.
why should we give deliver good quality software?
What is the scripting language used in QTP?
Is text area check point supports for web applications?
What are the Application Functions available in QTP?
difference Between Call Run action and copy of action?
Dear All , For UFT 12.02 which version QC or ALM will support ? Thanks Balaji
can we run the scripts of qtp 8.2 in the qtp7.0?
what is diff b/w function and action?