Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete for - deletes file
Message
De
09/05/2014 17:36:10
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01599805
Message ID:
01599809
Vues:
76
J'aime (1)
>I am having an issue that has just suddenly surfaced
>in programming when line reads
>
>Delete for namet = "XNAME"
>pack
>
>
>instead of deleting the records selected - VFP deletes the whole file.
>
>What's going on here?????? Halp!!!!

If your field "NameT" is longer than 5 characters (the length of your search string), be aware of partial/inexact string matches. By default, SET EXACT is OFF in VFP.
CLEAR

CREATE CURSOR Test ;
	( NameT C( 6 ) )

INSERT INTO Test ( NameT ) VALUES ( "XTEST " )
INSERT INTO Test ( NameT ) VALUES ( "XTEST2" )
INSERT INTO Test ( NameT ) VALUES ( "XTEST3" )
INSERT INTO Test ( NameT ) VALUES ( "XTEST4" )
INSERT INTO Test ( NameT ) VALUES ( "XTEST5" )

COUNT FOR NameT = "XTEST" TO Result1
COUNT FOR NameT == "XTEST" TO Result2
COUNT FOR NameT == "XTEST " TO Result3

?Result1 && 5
?Result2 && 0
?Result3 && 1

USE IN Test
The third type of COUNT or DELETE command is the one you likely want. It's a good idea to get used to using the "==" exact comparison operator, which always returns the result of an exact comparison regardless of the state of SET EXACT.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform