VFP 9 MySQL Select Data Type Problem
Posted on 2010-09-08
Hi All. I have an FP ap that I've been using for a couple of years now that selects data from around 50 mysql tables. All has been working fine until today when I installed the ap on a second PC.
On this PC and this PC ONLY I'm having a problem with some of the selects. Everything still works fine on the original PC. Both are WinXP SP3 utilizing ODBC 3.51.
The problems seem to stem from data type issues. Most I have fixed with simple IF vartype statements.
But one I simply can't get a handle on. The data is being selected from a MySQL 5.1.33 server running on WinXP SP3. The FieldType is Decimal 6,2.
After I connect to the db, I simply run:
lcQuery="SELECT nh1 FROM " + lcTableName
and use SQLEXEC to place the value into a Cursor.
The value of nh1 in the table is 0.190
However, any attempt to use the value returned as Numeric, for example a simple if statement:
IF (nh1 < 2)
WAIT WINDOW "T"
WAIT WINDOW "F"
fails with a mismatched data type error. It seems the date type of the value returned is Text.
I've tried using VARTYPE to change the data type, I've tried CAST, nothing seems to work.
Can someone PLEASE show me how to Convert this data to numeric, either in FP (preferrable) or in MySQL as it's being selected from the table?? Thx!!