Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Other user's data entry is appearing in User's entry scr
Message
De
18/12/2003 10:10:20
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
17/12/2003 22:43:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00846908
Message ID:
00860338
Vues:
19
Hi Kimberley

This is a bit rough and done from the top of my head, but here's a little program to demonstrate how a unique number might be generated. Please see if this works for you and look for differences in your technique. You'll need a NEWIDTABLE that is something like this...

CREATE CURSOR NEWIDTABLE (TABLENAME C(40), LASTID I)
APPEND BLANK
REPLACE TABLENAME WITH "THISTABLE",LASTID WITH 0 IN NEWIDTABLE


*Here's how to call it.
luNewKey = GETNEWID("THISTABLE")
IF VARETYPE(luNewKey)="L"
  RETURN .F.
ENDIF
APPEND BLANK
REPLACE uniquefield WITH m.liNewKey IN THISTABLE
RETURN .T.

*Here's the program that gets the new id.
GETNEWID.PRG
LPARAMETERS tcTable
IF NOT USED("NEWIDTABLE")
  USE NEWIDTABLE IN 0
ENDIF
IF NOT SEEK(m.tcTable,"NEWIDTABLE","TABLETAGNAME")
  RETURN .F.
ENDIF
IF NOT LOCK("NEWIDTABLE",RECNO("NEWIDTABLE"))
  RETURN .F.
ENDIF
LOCAL liNewID
REPLACE LASTID WITH NEWIDTABLE.LASTID + 1 IN NEWIDTABLE
liNewID = NEWIDTABLE.LASTID
UNLOCK RECNO("NEWIDTABLE") IN NEWIDTABLE
RETURN m.liNewID
>Hi, I just stumbled on a fix (though I don't like it).
>
>I put another record in the counters table (and left it blank), and in my code I do this:
>
>SELECT tblCounters
>LOCATE
>skip
>skip -1
>
>before assigning the value to the form object and replacing the table value with the table value + 1.
>
>This can't be the right way to do this, do either of you have any ideas?
>
>Kimberley (sob, sob)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform