Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table Order
Message
De
08/01/2010 15:34:27
 
 
À
08/01/2010 13:15:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01442768
Message ID:
01442844
Vues:
34
As others have pointed out
USE addition in 0
SELECT addition
SEEK addition.name &&Check for the name

doesn't really make any sense.

I would expect a "Table has no index order set" Error as you were finding earlier. Do you now have any error trapping in place that would hide the error message from you and allow the program to continue? If so, the result of FOUND() will probably be FALSE since that is the value when the table is opened.

If you don't have any error trapping in place, is it possible that you have consolidated your code and didn't include a line which sets an Index Order? If so, you may have an active index on something other than "Name" so the code will execute but not be looking for the right values.

Last thought is that you are actually searching for the value in the "other" table but there is a length mis-match and the extra spaces cause a problem.

At any rate, I'm making the assumption that you are working with only one name at a time. If so, how about something like
DO code that populates TableX

SELECT TableY
LOCATE FOR name = TableX.name
IF FOUND()
    THISFORM.UpdateResultsWindow('error name already entered')
ELSE
   THISFORM.continue 
  && for some reason this is always executed even when the name is already there
 ENDIF
Primarily for performance reasons TableY should have an index tag on "Name" but this code will work without it (just much more slowly depending on the size of the table)



>ok. i have Two table. Table X and Table Y
>when i press the button. i run an SQL so send the Data in question to Table X that works perfectly
>then i send the data from table X to Table Y thats where im kinda stumped.
>
>cause i search for Adition.name in a table if i find it program should say name found...if not found. its supposed 2 continue and allow the data to be sent to table Y. thing is table X only holds one record.
>
>So i open table X and i see the name Peter in table X
>then i open Table Y and i see the name Peter like 5 times(i executed 5 times)
>
>which tells me when the program ran the first time i seemed to work right and since the name wasnt there it sent it to table X then Y
>but when i ran it the second time it was supposed to give me the error message and it didnt instead it continued as if the name wasnt there
>but it did error and say that there was no index order
>
>
>
>USE ftab       
>
>USE addition in 0
>SELECT addition 
>SEEK addition.name &&Check for the name
>SCAN
>IF FOUND()
>THISFORM.UpdateResultsWindow('error name already entered')
>ELSE
>THISFORM.continue && for some reason this is always executed even when the name is already there
>ENDIF
>
>ENDSCAN
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform