Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What should I do if a DELETE fails?
Message
De
26/08/2006 23:26:22
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
26/08/2006 22:21:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP1
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01148871
Message ID:
01148876
Vues:
12
>Hi!
>
>Let's say I want to delete multiple records from some buffered related tables, but the commands fails. What should I do in this case in order to avoid any unexpected problems in my app?

More or less the same as with any other modification. Here is an example of getting information, in a form. A single record is deleted.
delete
if TableUpdate()
  skip
  ThisForm.Refresh()
else
  local laError(1)
  aerror(laError)
  MessageBox("Error deleting. Error #" + transform(laError(1));
    + " Message " + laError(2))
endif
Now, what do you do when you delete several records, and it fails? You must decide what is appropriate for the logic of the application.

For instance, you can continue deleting all the records you can, and show the user a list of records that can't be deleted.

Another possibility is to delete "all or nothing" - if you can't delete one record, undo everything. This, you would do with transactions.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform