Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Random search in a table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00968006
Message ID:
00968059
Vues:
13
This message has been marked as the solution to the initial question of the thread.
Claudio,

I am not sure why You need to use the Key for this, I would think that you leave your program open for an "endless" loop, for example your Key lenght allows 100.000.000 different records while you "only" have less than 2.000.000 records in the table, thus leaving a probability of 1/50 of getting a valid key.

If you think that the select statement can be slow, why don't you just generate a random record number?
Rand(-1)
lnRecno	= Int(Rand() * Reccount('Table')) + 1
go lnRecno in Table
lcKey = Table.key
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform