Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Locking with SQL7
Message
De
29/02/2000 15:35:32
 
 
À
29/02/2000 10:41:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00338970
Message ID:
00339378
Vues:
14
>>lSuccess = .f.
>>Do While Not lSuccess
>> cSQL = "SELECT LastNumber FROM NumberTable WHERE cKey = 'TABLENAME'"
>>
>> SQLExec(nConn, cSQL)
>>
>> nLastNumber = SQLResult.LastNumber
>> nNewId = nLastNumber + 1
>>
>> cSQL = "UPDATE NumberTable SET LastNumber = nNewID WHERE "+ ;
>> "cKey='TABLENAME' and LastNumber = nLastNumber"
>>
>> lSuccess = ( SQLExec(nConn, cSQL) = 1 )
>>EndDo
>
>
>Thanks Bob, this seems to be a good solution. Not the most elegant way to obtain the goal, but I suppose there is no better way. Wouldn't have found it myself ....

Of course, if you are using the value for a primary key, you may want to consider using the UniqueIdentifier data type and GUID values... this eliminates the need to go to the back end for every id.

BOb
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform