how can i change,insert,delete datawindow values powerbuilder 9?

Posted on 2004-10-06
Medium Priority
Last Modified: 2013-12-26
ok i have a datawindow with values

how can i edit,insert,delete,move through(back and forward) these values...?
Question by:stefanosn
  • 3
  • 3
LVL 33

Assisted Solution

sajuks earned 375 total points
ID: 12245335
From your comments it seems that you are a beginner in Pb
What you should do first is go thru the PB examples whcih would have been installed along with your PB 9 installation.
Check inside the folder "C:\Program Files\Sybase\PowerBuilder 9.0\Code Examples\Example App" or wherev'r you installed Pb.
Incase it is not installed,Click on this link
It will ask you to login , create a username/password ( its free )
Then download the zip file and check th examples.
Particularly those that come under Datawindows.

To download PB examples you can also navigate  from your Start menu.
In the Programs > Sybase ? Powerbuilder 9 > there is a PB 9 code samples link.

LVL 33

Accepted Solution

sajuks earned 375 total points
ID: 12245393
For insert/update/delete there are two ways to go about it ( actually theres more ,am just showing you so that you can get started),

First Way:
Lets assume that  you have created a datawindow object ( d_customer )
Now in the datawindow ,In the Footer band
Insert three buttons ( Insert > Control > Button )
Name it as b_add, b_delete, b_save
In the properties of these buttons> in the general tab > assign the actions as InsertRow(12) , DeleteRow(10) , Update(13) from the drop down.
Thats it , in a window w_main, attach this dataobejct to the datawindow control and click on these buttons.

Second way:

Assumption made is that there exists a dataobject d_customer
There exists a window w_main which has a dw control dw_main to which is attached the dataobject  d_customer.

In the window add three buttons, add,delete,save.
In the add button the code would be something like

In the delete button it would be dw_main.DeleteRow(0)

In the Save button it would be something like
integer rtn
rtn = dw_main.Update()
IF rtn = 1 THEN

Please note that this is a very basic example to get you started. While coding you will be doing a lot more of validations and other error checking.

From you PB help file check the examples for

Also check this link for some simple examples

But i would highly recommend going through the powerbuilder examples.


Author Comment

ID: 12246417
i put a button but insertrow(12) does not do nothing!

other buttons like forward, backward move work

but not insertrow(12) - do i have to do something else?

i supposed that a new line should have been shown at the datawindow to insert
the new row...
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

LVL 33

Expert Comment

ID: 12255723
Can you specify the process in which you did the insertrow step.
Does it give any message/error ?
Are you able do an insertrow if you do it from a window button?

Author Comment

ID: 12256365
long ll_newrow

ll_newrow = dw_3.InsertRow(0)


this code is assigned to a button that i created at the form not the datawindow

at the clicked() event exists the above code.

a new line appears at the datawindow when i press the button but is not editable. I can not write in the fields.

Author Comment

ID: 12256665
never mind found it its ok thank you all!

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

619 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