Home » Developer & Programmer » Forms » delete record (forms 5.0)
delete record [message #454189] Tue, 04 May 2010 07:00 Go to next message
jsushanta
Messages: 3
Registered: May 2010
Junior Member
Dear All,
How can I delete a record by writing code in when_button_pressed trigger.

thanx.
Re: delete record [message #454192 is a reply to message #454189] Tue, 04 May 2010 07:08 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
What's wrong with using the delete button on the tool bar?
Re: delete record [message #454193 is a reply to message #454192] Tue, 04 May 2010 07:12 Go to previous messageGo to next message
jsushanta
Messages: 3
Registered: May 2010
Junior Member
I have written code "delete from mcl_sar_login where user_name=:user_name; commit;" It shows 1 record applied but the record is not removed from the table. pls. help. I want to know what mistake I have done in coding.
Re: delete record [message #454196 is a reply to message #454193] Tue, 04 May 2010 07:27 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
but the record is not removed from the table

From a table, or from a form? Did you re-query?
Re: delete record [message #454283 is a reply to message #454196] Tue, 04 May 2010 22:55 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Why are you doing a manual delete?

If your block is based on 'mcl_sar_login' then use 'delete_record'.

When doing a manual operation in Oracle Forms use the manual commit called 'standard.commit'.

David
Re: delete record [message #454287 is a reply to message #454283] Wed, 05 May 2010 00:08 Go to previous messageGo to next message
jsushanta
Messages: 3
Registered: May 2010
Junior Member
Sir,
Yes my block is mcl_sar_login. But by delete_record the record is not deleted from database. My code is :
begin
--v_user := :user_name;
delete from mcl_sar_login where user_name = :mcl_sar_login.user_name;
delete_record;
standard.commit;
clear_form;
go_item('user_name');

end;
Re: delete record [message #454290 is a reply to message #454287] Wed, 05 May 2010 00:14 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Basically, what you do is wrong.

Remove that button (doing so, trigger will also be deleted) and use Forms' toolbar which contains a "delete record" button.

If you insist on your own code, then
delete_record;
standard.commit;
is all you need.
Re: delete record [message #454324 is a reply to message #454290] Wed, 05 May 2010 01:30 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
@LF,

Actually, the forms 'commit' would recognise the 'delete_record'.

David
Re: delete record [message #454330 is a reply to message #454324] Wed, 05 May 2010 01:40 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes, it would. Sorry,
delete_record;
commit;
should be OK.
Previous Topic: Upgrade Cliente FORMs
Next Topic: Sending mail with attachment
Goto Forum:
  


Current Time: Fri Sep 20 08:37:43 CDT 2024