Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO from VB to query FoxPro tables
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00181924
Message ID:
00182042
Views:
14
>Try...
>SELECT * FROM MainCase WHERE Office + CaseNo Like "198-0000%"
>
>or
>
>SELECT * FROM MainCase WHERE left(Office + CaseNo,8) = "198-0000"

Bob,

Thanks for your reply! I finally figured out the problem after spending much of the day on this. It has to do with SET ANSI ON|OFF. When running an SQL SELECT in VFP, SET ANSI is OFF, while the default for the ODBC drive is ON. This setting determines how SQL comparisons are performed, similar to SET EXACT.

Anyway once I did a oConn.Execute("SET ANSI OFF"), the query worked! I should mention that there is a bug in the previous version of this drive where this setting cannot be turned OFF. (See MS KB Article Q169155.)

Although your solution works, the table is huge, and I cannot create an index for LEFT(...). It appears as though the LIKE clause uses the index (Office + CaseNo); therefore, it works too! This is nice to know.

Thanks again!
Previous
Reply
Map
View

Click here to load this message in the networking platform