Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

database updates...

Former Member
0 Likes
393

hi,

A quick question on the best way to handle the data input in the table control on screen.

assume i have a table control in which user enters 5 records and chooses to save. these 5 records are INSERTED in the custom table.

next time he chooses to delete 2 of them modify 2 of them, leave one unchanged and add 2 more.

so whats the best way to update the custom table based on these changes ??

Simply delete the earlier 5 from custom table and then based on what is available in the TC , insert into the table ??

or

update the table with the 2 that were modified,

insert the new ones

delete the ones that were removed from the TC

any suggestions ??

thks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
376

>update the table with the 2 that were modified,

>insert the new ones

>delete the ones that were removed from the TC

this is the approach.

standard transactions also do the same thing.

2 REPLIES 2
Read only

Former Member
0 Likes
377

>update the table with the 2 that were modified,

>insert the new ones

>delete the ones that were removed from the TC

this is the approach.

standard transactions also do the same thing.

Read only

Former Member
0 Likes
376

Hi,

Use Delete statement to delete the records from custom table.

Use modify statement to update the rest. Modify statement will update all the records in custom table by comparing the key fileds. If the entry is already existing it will update fields other then key fields, which is equivalent to update statement.

If the key fields are not present, it will create a new entry in the custom table.

To reduce the no:of statements in the program u can go with

Modify and delete, which will suffice your requirement.

- Krishnan