Solved

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

Posted on 2004-10-06
6
1,055 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 125 total points
Comment Utility
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 125 total points
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 33

Expert Comment

by:sajuks
Comment Utility
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
Comment Utility
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
Comment Utility
never mind found it its ok thank you all!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

728 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

8 Experts available now in Live!

Get 1:1 Help Now