Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seeking a string in a numeric field is OK?
Message
From
15/10/2009 10:05:50
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Seeking a string in a numeric field is OK?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01429483
Message ID:
01429483
Views:
142
Today I discovered that VFP does not care if you try to seek a string in a numeric field.

Has this always been the case? Try this code:
CREATE CURSOR csrJunk (f1 I, f2 B, f3 N(5,2))

INSERT INTO csrJunk VALUES (1, 1111.1111, 1.11)
INSERT INTO csrJunk VALUES (2, 2222.2222, 2.22)
INSERT INTO csrJunk VALUES (3, 3333.3333, 3.33)
INSERT INTO csrJunk VALUES (4, 4444.4444, 4.44)

INDEX on f1 TAG f1
INDEX on f2 TAG f2 ADDITIVE 
INDEX on f3 TAG f3 ADDITIVE  

WAIT WINDOW SEEK(3, "csrJunk", 1)		&& Returns .T.
WAIT WINDOW SEEK(3333.3333, "csrJunk", 2)	&& Returns .T.
WAIT WINDOW SEEK("3.30", "csrJunk", 3)		&& Returns .F. I expected a Data type mismatch error

WAIT WINDOW SEEK(.T., "csrJunk", 1)		&& Error - Data type mismatch
WAIT WINDOW SEEK({^2000/01/01}, "csrJunk", 1)	&& Error - Data type mismatch
Why doesn't the third wait window cause an error like I think it should! Bug? By design?

TIA
Mike
Next
Reply
Map
View

Click here to load this message in the networking platform