how to retrieve data from
flight resevation->reports
Answer Posted / 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 View All Answers
What are the different ways to invoke an application using QTP?
when will you do debug your script? and explain that process?
give me the code to save all messages of inbox of gmail into a folder and notepad
i am trying to automate yatra.com,in that site, when i go to automate the Leaving from field showing as a WEBEDIT, but when i enter 1 or 2 char, it displaying dropdownlist, i try to use keyboard automation to select the item from that list but it is not possible, can anybody help he. Thans for posting the Answer
What is action?
What are the different attributes used with regular expression?
Hi, Hope you viewers are doing fine with good health. What are the steps and connection parameters to connect to Oracle db ? Can you connect with just the Oracle client or Oracle XE ? Cheers!!
What is action? How many types of actions are there in qtp?
Can any suggest me what is exposure testing?
How many types of recording modes in the qtp?
what is defenetion of kiran can u tell me plz CVS, SVN
hi all here i have tab named "Workbench" By clicking on "workbench" tab.it displays 4 tabs like below workbench common cargo commercial charter "common" tab have 10tabs inside,"cargo" tab also haveing 15 tabs inside and remaining two tabs also having few tabs inside. when clicked on "common" tab.it displaying the script like tab("workbench").select"common" if i clicked on "cargo".it displaying the script like tab"workbench_2").select"cargo" if i clicked on "commercial".it displaying the script like tab"workbench_3").select"commercial" if i clicked on "charter".it displaying the script like tab"workbench_4").select"charter" I have used a "FOR LOOP" for common,commercial,cargo,charter tabs.it was stopped at second tab SO, CAN I RECOGNIZE "WORKBENCH_2,_3,_4" AS A SINGLE VARIABLE if not, can anyone plese help me to solve this
Difference between test object and run time object?
What is the difference between analog and low level recording?
How to carry out bit map check points in QTP