Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MyTable.NextID
Message
De
25/09/2007 19:09:43
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
25/09/2007 18:53:57
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01256809
Message ID:
01256819
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
>I found that issue, but how do I find your article? Don't see a search function and the titles of the articles are truncated on the left sidebar for me.

No idea what went wrong. One way is through my contribution summary. On the other hand, when you go into any article, there is an index ComboBox at the top, where you can select an article.

Here are the two functions from the appendix, for your references.

1. SerialNumber(), requires a table SerialNumber.dbf (sequence C(20), nextnum I), and an index on Sequence. Function is placed in database stored procedures, and invoked from the field default value.

2. GUID - this is a longer key, 16 bytes. It should guarantee uniqueness, even if computers don't have permanent access to a central database.
* Function SerialNumber

* Get serial number. Used mainly to generate primary keys.
* The easiest way to achieve this is to call this function from a fields
* default value.
FUNCTION SERIALNUMBER(tnSequence)
tnSequence = lower(tnSequence)
local lnSelect
lnSelect = select()
if used("serialnumber")
   select serialnumber
   else
   select 0
   use serialnumber
endif
set order to "sequence"
seek padr(tnSequence, len(sequence))
if not found()
   append blank
   replace sequence with tnSequence, nextnum with 1
endif
local lnReturnValue
if lock()
   lnReturnValue = nextnum
   replace nextnum with nextnum + 1
   else
   lnReturnValue = -1
endif
unlock
flush
select (lnSelect)
return lnReturnValue
ENDFUNC
* Function for GUID
PROCEDURE GetGUID
DECLARE INTEGER CoCreateGuid ;
  IN Ole32.dll ;
  STRING @lcGUIDStruc

cStrucGUID=SPACE(16)
cGUID=SPACE(80)
nSize=40
IF CoCreateGuid(@cStrucGUID) # 0
  RETURN ""
ENDIF
return cStrucGUID
ENDPROC
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform