Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using == vs =
Message
De
08/11/2015 14:40:20
 
 
À
08/11/2015 13:59:12
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., Nouvelle Zélande
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01627149
Message ID:
01627228
Vues:
62
>>>I am absolutely convinced that you are wrong. I am curious to see if you can prove your statement.
>
>I think we're both right- sort of! VFP Help confirms that if two strings are compared with the == operator, the expressions must contain exactly the same characters, including blanks, to be considered equal and that SET EQUAL is ignored.
>
>
CREATE CURSOR c1 (myfield1 c(10),myfield2 c(11))
>
>? c1.myfield1==c1.myfield2
>? c1.myfield2==c1.myfield1
>
>INSERT INTO c1 VALUES ("Hello","Hello")
>
>? c1.myfield1==c1.myfield2
>? c1.myfield2==c1.myfield1
>
>
>.F.
>.F.
>.F.
>.F.
>
>However if using SQL, == acts the same as = with SET ANSI ON- IOW the shorter string is padded.
>
>
CREATE CURSOR c1 (myfield1 c(10), myfield2 c(11))
>
>INSERT INTO c1 VALUES ("Hello","Hello")
>
>SELECT * FROM c1 WHERE myfield1==myfield2
Well, to be honest I answered to what I was sure you meant, which was not what you wrote. You wrote "I have seen issues comparing fields of unequal length, where == always fails" which is of course always false. I thought you meant to say that you have seen cases where this comparison resulted in true.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform