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

Please explain about unicode compatibility in QTP. how we can able to use it. Please help me

1 Answers  


What are the different recording modes?

0 Answers  


How many add-ins comes by default with quicktest professional?

0 Answers  


Can we select add ins in UFT during run time

1 Answers   NIIT,


In where you are keeping or maintaining shared object repository (file)in your appliction?

2 Answers   Inlogic,






any body can you help me what is the script to automate an comand promt

0 Answers  


w is output value

3 Answers   MBT,


What is the main differece between QTP 9.0 and 9.2

1 Answers   VeriSign,


how to test Web application using QTP software

4 Answers   BITS,


Hi..friends can anybody write the script for this question... Am having some 20 nos of links in a web application, i want to click some 5,13 & 17th links. So please....can anybody give the answer....??? -->Hani<--

4 Answers  


Hi,i have 3 years of experience in manual and Automation qtp.present i am searching for job in automation qtp 2Yrs,How to Explain the interviwer Roles and Responsibilites.please help me.

1 Answers  


how to get font size of a "WebEdit"

3 Answers   L&T,


Categories