Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Duvidas sobre Integridade e PDV
Message
De
17/05/2003 16:16:04
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
17/05/2003 15:51:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00788041
Message ID:
00789754
Vues:
24
This message has been marked as a message which has helped to the initial question of the thread.
>Ok,
>
>Eu uso caracter pois me pareceu na época o mais correto isto a 6 anos atraz, desde minha versão em Fox 2.5 for dos, então troxe isso até agora, e estou querendo mudar tudo nesta nova versão em VFP 6.0.

Ista é a minha função para números seriáis:
**********************************************************************
FUNCTION SerialNumber(tcSequence)
	* 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.
	* Example: default value for primary key "Client" of table "Client" = SerialNumber("Client")
	* This function accesses table SerialNumber. Fields: Sequence C(30), NextNum I.
	tcSequence = lower(tcSequence)
	local lnSelect
	lnSelect = select()
	if used("serialnumber")
		select serialnumber
	else
		select 0
		use serialnumber
	endif
	set order to "sequence"
	seek padr(tcSequence, len(sequence))
	if not found()
		append blank
		replace sequence with tcSequence, nextnum with 1
	endif
	local lnReturnValue
	if lock()
		lnReturnValue = nextnum
		replace nextnum with nextnum + 1
	else
		lnReturnValue = -1
	endif
	unlock
	select (lnSelect)
	return lnReturnValue
ENDFUNC
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