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

ok i have a datawindow with values

how can i edit,insert,delete,move through(back and forward) these values...?
stefanosnAsked:
Who is Participating?
 
sajuksConnect With a Mentor Commented:
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
 
sajuksConnect With a Mentor Commented:
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
 
stefanosnAuthor Commented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
sajuksCommented:
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
 
stefanosnAuthor Commented:
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
 
stefanosnAuthor Commented:
never mind found it its ok thank you all!
0
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.

All Courses

From novice to tech pro — start learning today.