1. Deva Shanmuga
  2. PowerBuilder
  3. Tuesday, 4 June 2024 15:01 PM UTC

Hi Experts,

When updating a DataWindow, I have two options: "Use Delete then Insert" and "Use Update." Can you explain the usage of these options? When should I use each one, and what happens if I choose the wrong option while saving?

Thanks

Deva.S

mike S Accepted Answer Pending Moderation
  1. Tuesday, 4 June 2024 19:12 PM UTC
  2. PowerBuilder
  3. # 1

to be clear, that option is only relevant if the primary key values are being changed (what the datawindow has set for unique key columns, not necessarily the primary key).  In other words, if you are not updating what was set for a key column then it will just be an update regardless of the setting used.

 

 

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 4 June 2024 15:13 PM UTC
  2. PowerBuilder
  3. # 2

Hi.

It's exactly what they describe:

  • Use Delete then Insert: When updating a row it will first delete it and then re-insert it. This means that if you are using identity or autonumbers you will probably end up with a new value. Also, if there are any insert - delete triggers they will be executed!
  • Use Update: An update statement will be issued. Update trigger will be executed.

Andreas.

Comment
  1. Roland Smith
  2. Tuesday, 4 June 2024 20:15 PM UTC
As Mike said, this is only for when one or more of the key columns changes.
  1. Helpful 1
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 4 June 2024 15:07 PM UTC
  2. PowerBuilder
  3. # 3

The difference is when you have any triggers defined on the table for delete, insert or update.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.