Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ADO / VFP
Message
De
24/10/1998 11:34:02
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
 
 
À
24/10/1998 11:25:42
Eric Barnett
Barnett Solutions Group, Inc
Sonoma, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00150131
Message ID:
00150148
Vues:
17
Sorry, the message got cut off. To continue:

FUNC newid()
LOCAL nOldSel,cAlias,nNewKey,cOldReprocess
nOldSel=SELECT()
cAlias=ALIAS()
cOldReprocess=SET("REPROCESS")
SET REPROCESS TO AUTOMATIC
IF !USED(mydatabase!identity)
USE mydatabase!identity IN 0
ENDIF
SELECT identity
IF SEEK(UPPER(cAlias), "identity", "TABLENAME")
IF RLOCK()
nNewKey=identity.keyvalue
REPLACE identity.keyvalue WITH identity.keyvalue+1
UNLOCK
ELSE
nNewKey=-1
ENDIF
ELSE
nNewKey=-1
ENDIF
SELECT (lnOldArea)
SET REPROCESS TO lcOldReprocess
RETURN nNewKey
ENDFUNC

The error trapping isn't very sharp in this example, but you'll get the idea.
Of course, an index on TABLENAME is required for table IDENTITY.

Eric Shaneson
Cutting Edge Consulting

>>We are using ado to connect databases over the internet
>>
>>We have a problem with defining new key's using ado
>>
>>Normally we have an extra databases with the latest en highest
>>keys per table.
>>
>>If we create a new key we lock the record and create a new keynumber
>>
>>What is the best way to do this with ado example please.
>>
>>Kind regards
>>
>>
>>Jan Dorresteijn
Eric Shaneson
Cutting Edge Consulting
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform