Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-10-06
6
Medium Priority
?
1,278 Views
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...?
0
Comment
Question by:stefanosn
  • 3
  • 3
6 Comments
 
LVL 33

Assisted Solution

by:sajuks
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
http://powerbuilder.codexchange.sybase.com/servlets/ProjectDocumentList?folderID=540.
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.



0
 
LVL 33

Accepted Solution

by:
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
dw_main.InsertRow(0)

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
        COMMIT USING SQLCA;
ELSE
        ROLLBACK USING SQLCA;
END IF

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
Insertrow
Update
Deleterow


Also check this link for some simple examples
http://www.justpbinfo.com/pbtips/default.asp

But i would highly recommend going through the powerbuilder examples.


0
 

Author Comment

by:stefanosn
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...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:sajuks
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?
0
 

Author Comment

by:stefanosn
ID: 12256365
long ll_newrow

ll_newrow = dw_3.InsertRow(0)

dw_3.ScrollToRow(ll_newrow)

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.
0
 

Author Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
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: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

971 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