Retrieve values

Posted on 2011-04-28
Last Modified: 2013-12-26
I am new to powerbuilder. i am having problems passing and Retrieving values.
How do i pass the values to the datawindow where my SQL resides.
IF there is more than one row(result) i want to do something else.

I created a DataWindow. The datawindow has a sql statement.
SELECT test1, test2, test3 from product
   WHERE (test1 = :test1 ) AND  
         ( test2 = :test2 ) AND  
         ( test3 = :test3 )  

Now in my code
i am assigning the dataobject
DW.DataObject = 'DW_update' this is my datawindow name

Here i  am assigning the values for the sql statement the SQL gets three arguments
Test2= "cyto"

My question is how do i pass the values to the datawindow and if there are more than zero rows i want to do something else.

Question by:soorraj
    LVL 3

    Accepted Solution

    long retval
    retval=DW.retrieve( test1, test2 , test3 )
    CHOOSE CASE retval
        CASE 0
            Do Something else // No rows returned
        CASE IS > 0
            Do Something // Greater than zero rows returned
        CASE IS < 0
            Error alert // Return value less than 0 is an error

    Open in new window

    LVL 3

    Expert Comment

    I'm assuming you have already assigned a transaction object to the datawindow control to connect it to the database e.g.


    Open in new window

    LVL 1

    Author Closing Comment

    Thanks it worked

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now