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

How can we check whether a particular sheet loaded (existed) or not in Data Table.

7 Answers   TCS,


what type of framework u r using in ur organization

0 Answers   Wipro,


What are the differences between quicktest professional and winrunner?

0 Answers  


how can i impliment error handling in QTP?

5 Answers   Ordain Solutions,


Is it possible to run qtp scripts in Test Director(Scripts are uploaded in Test director)???and also how to see the test results in test director???

1 Answers  






I have a 10 lines of qtp script, while executing i got an error at line 7 but i dont want to stop the execution i want to continue the execution up to last line and display the test result window, wts the syntax we use?

3 Answers   BirlaSoft, Collabera,


What is the use of breakpoint in qtp?

4 Answers   Zensar,


How do client side image and server side image work?

0 Answers  


i need qtp tutorial. pls send it to sridhar.k151@g mail.com

0 Answers  


how u will describe testing activities?

2 Answers  


How do you find out whether the string is Numeric or Alpha numenric.Suppose..'QTP is an automation testing tool 12345' How should I know it is alphanumeric.Can any one please write the code for this

4 Answers  


How to start recording using quicktest professional (qtp)?

0 Answers  


Categories