Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird MySQL Behavior
Message
From
15/02/2011 07:56:07
 
 
To
15/02/2011 06:39:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01500180
Message ID:
01500212
Views:
49
Tore,

You write that you get the correct result. Are you sure that you see a different result, and not the result from the previous attempt?

Positive sir. In my form class, I have a textbox where user types in some value. There is a combobox that allows user to choose field/column to search. Once user hits the Search button, it constructs the CA's SelectCmd on the fly.

If the CA's SelectCmd only involves a single table source, everything is all fine. Problem arises when the SelectCmd is made up of more than one table source. Like the one I showed:
SELECT A.REFNO, A.DATE, A.SUPPLIERID, A.TERMS, A.TOTQTY, A.AMOUNT, A.REMARKS,
     A.PREPAREDBY, A.CHECKEDBY, A.PRINTDATE, A.POSTDATE, A.CLOSED, A.CANCELLED, A.ID,
     B.CODE AS SUPPCODE, B.DESCRIPTOR AS SUPPNAME, B.ADDRESS AS SUPPADDR
FROM pohdr A JOIN SUPPLIER B ON A.SUPPLIERID=B.ID  WHERE B.DESCRIPTOR LIKE 'ABC%'
ORDER BY REFNO
As you can see from the above code, B.DESCRIPTOR has an alias of SUPPNAME. If I use:
WHERE SUPPNAME LIKE 'ABC%'
It generates an error both on the VFP side, and on MySQL Query Browser.

If I change it to:
WHERE B.DESCRIPTOR LIKE 'ABC%'
It works on MySQL Query Browser. In VFP side though, it first shows an error (trapped by my code) first (Unknown column in where clause), but show the correct results.

Dennis
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform