Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How would you do this?
Message
 
À
10/11/1999 15:15:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00287031
Message ID:
00290029
Vues:
49
>>Another question. After issuing UPDATE InvoceHeader SET LockedByUser=UserName WHERE InvoceID=ID and LockedByUser=null, and it fails, the table InvoiceHeader is at EOF(). All subsequent UPDATE's will now fail.
>
>UPDATE will work no matter where the record pointer is when you issue the command. You do not have to GO TOP prior to using this.

I know I shouldn't have to but this is what happens. Here is the actual code from my Contractor form and the scenario that causes this:


USER1: UPDATE Contractor SET LockedBy=mcuser WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName ;
AND ISNULL(Contractor.LockedBy) && Successful

USER2: UPDATE Contractor SET LockedBy=mcuser WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName ;
AND ISNULL(Contractor.LockedBy) && UnSuccessful

USER1: UPDATE Contractor SET LockedBy=NULL WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName &&Successful

USER2: UPDATE Contractor SET LockedBy=mcuser WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName ;
AND ISNULL(Contractor.LockedBy) && UnSuccessful

If I change USER2's last action to:

GO TOP IN Contractor
USER2: UPDATE Contractor SET LockedBy=mcuser WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName ;
AND ISNULL(Contractor.LockedBy) && Successful

or if USER2 moves to a different record and issues only:

USER2: UPDATE Contractor SET LockedBy=mcuser WHERE Contractor.Proj+Contractor.CompanyName=ContractorView.Proj+ContractorView.CompanyName ;
AND ISNULL(Contractor.LockedBy) && Successful

ContractorView is buffered optimistic record. Any ideas?

>
>>I get around this in VFP by issuing GO TOP IN InvoiceHeader first and then the UPDATE. Would the same thing happen with SQL-Server and how would I issue the same type of workaround?
>>
>
>You should be able to send the same statement to SQL server as above.
>
>BOb
Colin Magee
Team Leader, Systems Development
Metroland Media Group Ltd.
Mississauga, Ontario, Canada

cmagee@metroland.com

Never mistake having a career with having a life.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform