Micro Focus QTP (UFT) Forums
QTP Database conenction and parameterization of the values - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP Database conenction and parameterization of the values (/Thread-QTP-Database-conenction-and-parameterization-of-the-values)

Pages: 1 2 3 4 5


RE: QTP Database conenction and parameterization of the values - somisays - 07-25-2008

hi,
It seems problem with the connection string.
Try using the DSN conn string..

Code:
Conn.Open("DSN=devmitg;username=xxx;password=yyy;")

And let me know the result.


RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

Hi sridhar ,

I modified the code just trying to get the meanings of the table .

Here the loop got no ending it is showing the !st values as America .It is an unending loop.

I have 5 values Americas,Europe etc but it is showing me Americas only all the time and it is an unending loop .

I believe the record count is not working

Please do help me by viewing the code

Code:
Set conn=CreateObject("ADODB.Connection")
    conn.Open("DRIVER={Oracle in OraHome92};SERVER=DEVMITG;UID=ITL_ASSET;PWD=ITL_ASSET;DBQ=DEVMITG")

   Set rs = CreateObject("ADODB.recordset")
sql = "Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' "

      rs.Open sql,conn
  
'            Recordcount = rs.Recordcount

                  While(NOT Rs.EOF)
                Msgbox rs.Fields("Meaning")

                    For i=1 to Recordcount
'                     rs.MoveNext
'    

              Next
wend

   conn.close
  rs.close



RE: QTP Database conenction and parameterization of the values - somisays - 07-25-2008

Dear Siri,

You commented Rs.MoveNext ...
So that's why it is on only first record.
So take that out it is going to workout.


RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

I have removed

this is my modified script
still it is showing me as americas only whe n i catch the meaning it is nto showing me the next meanin g







Code:
Set conn=CreateObject("ADODB.Connection")
                                      conn.Open("DRIVER={Oracle in OraHome92};SERVER=DEVMITG;UID=ITL_ASSET;PWD=ITL_ASSET;DBQ=DEVMITG")

           Set rs = CreateObject("ADODB.recordset")
           sql = "Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' "

                      rs.Open sql,conn
  
                             Recordcount = rs.Recordcount

                                                            While(NOT Rs.EOF)
                                                            Msgbox rs.Fields("Meaning")
                                                            For i=1 to Recordcount

                                                                rs.MoveNext


                                                                

                                                            Next
                                                            Wend

                                                            rs.Close
                                                            conn.Close



RE: QTP Database conenction and parameterization of the values - somisays - 07-25-2008

Dear Siri,
do couple of things for me..

1)Please check the record count ? how many records ?
2) Please go to SQLPLUS and do the following query
see how many records comes. and lete me know...

Code:
sql = "Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' "



RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

There are 5 records

SQL> Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' ;

CODE
--------------------
MEANING
--------------------------------------------------------------------------------
1
Americas

2
Europe

3
Asia


CODE
--------------------
MEANING
--------------------------------------------------------------------------------
4
Global

5
Unknown


RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

but i am specifying only the meaning

SQL> Select Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' ;

MEANING
--------------------------------------------------------------------------------
Americas
Europe
Asia
Global
Unknown


RE: QTP Database conenction and parameterization of the values - somisays - 07-25-2008

Hi,
That is fine..
But what is the recordcount in QTP message box you are getting.


RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

Hi
I am getting as Americas in an infinite loop.
The next meaning is not populating

As i am taking the Meaning i am getting Americas and the next too americas instead of Europe
Msgbox rs.Fields("Meaning")


RE: QTP Database conenction and parameterization of the values - siri - 07-25-2008

I believe the loop is not closed properly