Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP Database conenction and parameterization of the values
#33
Solved: 11 Years, 4 Months ago
Hi Sridhar ,

The following code is working ,but here in the test results pane it showing me the data in the data table but not in the Expert view window .
I believe we need to save so any function to save such as rs.save



Code:
'Data base connection'

                   Set conn=CreateObject("ADODB.Connection")
                                 conn.Open("DRIVER={Oracle in OraHome92};SERVER=DEVMITG;UID=ITL_ASSET;PWD=ITL_ASSET;DBQ=DEVMITG")
'rs connection record set'
                Set rs = CreateObject("ADODB.recordset")

                
' Specify the query'

                               sql = "Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' "      
'ctr=0
                                         
'Execute the Query’
                rs.open sql,conn  
                
    'Get the no records returned by query’
'                           Code.GetROProperty (Property, [PropertyData])




        
'Adding a column to datatable’
For each fields in rs.fields

      
DataTable.GlobalSheet.AddParameter fields.name , ""

        Next
rs.MoveFirst

iRow = 1
Do
DataTable.SetCurrentRow iRow
'DataTable("Code",dtGlobalSheet) = rs.fields("Code")
DataTable("Meaning",dtGlobalSheet) = rs.fields("Meaning")
iRow = iRow + 1
rs.save
rs.MoveNext
loop until rs.EOF




       'Get the values from the Meaning column’
                

                                              While(NOT rs.EOF)
'                                        ctr=ctr+1
'                                            For i=1 to Recordcount
'                                                   Msgbox rs.Fields("code "+"meaning")
'                                                   Msgbox (rs.Get Row )
'                                                   Msgbox rs.Fields("Meaning")
'                                             DataTable.SetCurrentRow(i)

                                            
'Writing the data to the datatable’
'                      DataTable("Meaning",DtGlobalSheet) = rs.Fields("Meaning")                
                                                 rs.MoveNext
'                                                 Next
'                                            ctr=ctr+1
                                                 wend
'                                                                       Msgbox (ctr-1)

'close the database connection’
'DataTable.Export "C:\DatabaseExample.xls"
                    rs.close
                    conn.close
Reply


Messages In This Thread
RE: QTP Database conenction and parameterization of the values - by siri - 07-28-2008, 01:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Action Parameterization Issue Slothman 1 1,970 10-31-2020, 01:05 PM
Last Post: Ankur
  Business Components Parameterization YogeshCallappa 0 1,628 06-07-2017, 04:32 PM
Last Post: YogeshCallappa
  Parameterization Hanskanika 0 1,650 11-20-2015, 04:45 PM
Last Post: Hanskanika
  QTP database seach siitohan 1 2,564 02-19-2013, 07:07 AM
Last Post: basanth27
  QTP 11.5 PARAMETERIZATION ERROR QTP(UFT)11.50 mseroney88 2 3,652 01-22-2013, 10:51 AM
Last Post: mseroney88

Forum Jump:


Users browsing this thread: 14 Guest(s)