Solved

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

Posted on 2004-10-06
6
1,080 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
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 125 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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.

786 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