how to retrieve data from
flight resevation->reports

Answers were Sorted based on User's Feedback



how to retrieve data from flight resevation->reports ..

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

how to retrieve data from flight resevation->reports ..

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

Post New Answer

More QTP Interview Questions

What is Performance testing?

2 Answers   Crea,


in Qtp,how to display user name and pwd (script)in data table(global sheet).

2 Answers  


what is the difference between window command and dialog command

1 Answers  


Hello everybody, can we maintain the state of page in QTP? 1. suppose i opened a notepad text file i entered some text and changed the font type and font size and saved that file. 2. Now next time when i will open a new notepad file it is showing me that font type and size which i changed in my previous step. 3. Here i want that QTP should capture the default setting i.e. it should maintain the state of the page. Thanks in advance, Gaytri

0 Answers  


What are the views available in quicktest professional?

0 Answers  






What is difference between QTP 8.2 Obect Repository and QTP 9.2 object Repository?

2 Answers   Nokia,


in qtp how can we do test when the build is not ready

3 Answers   Mindlance,


What is the dis advantage of check points in QTP, if any?

6 Answers   BirlaSoft,


How to retrieve data from application objects?

1 Answers  


Hi All, I am 4 yrs experieced in manual testing and new to automation tool QTP. Iam trying to learn it thru online and material i have.I am able to understand but unable to trace out which method or function to be used where necessary in VB Script. How come we know the functions or methods to be used to open a window when clicking on button or so...Pls suggest me.How can i proceed further to apt VB Script.

0 Answers  


Can I compare two DataBases using QTP ?

1 Answers  


if there is a web table of having row and colmns.a button is placed at 2nd row's 3rd column which is worked for both edit and delete..how to write script for the button to test both operation on the web table using desriptive programing.. plz help me on script wheather using getroproperty Q2)what is the command for taking valiue from a web table in qtp

6 Answers   Logica CMG,


Categories