Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Multiuser Programing with ms-sql
Message
 
À
29/07/2003 03:49:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00813064
Message ID:
00814743
Vues:
16
Well the first thing I would do is remove all of the transaction stuff from this code. All of that is being handled by SQL. So you can bring it down to :

if !tableupdate(...)
tablerevert()
messagebox("tell User")
endif

I assume that you have BufferMode of 5 because you are updating more than one row in HARVIEW? Otherwise, mode 3 will do row by row optimistic updates.

I would suggest to you that if your concern is that user B will delete an invoice that user A is working on, there should be a DELETE trigger on the SQL table that looks to see if the invoice is active, i.e. has lines on it.

If there are any, issue a RAISERROR in the trigger and then user B will see a message.

I hope that helps - this is why I said you need to think differently when working with SQL Server. The backend is doing all of the data processing. The only thing the VFP should be doing is painting screens, interacting with the user, client-side validation and passing messages and data to and from SQL. The subject of client-side validation is a whole new ball game - it really depends on how complex your business rules are as to the approach to take with this. If you know the rules now and they are unlikely to change much, then put them in a middle tier. If however you're going to have a web interface to your app and that will be talking directly to SQL, then put the business rules there in triggers. This is generally faster anyway unless you're servicing a lot of users. The nearer the data manipulation code is to the data it is working on, the more efficient it will become.

Regards
Simon

Regards
Simon
SJC Systems Limited
WorldSpreads Limited (www.worldspreads.com)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform