PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Problem with VFP Numeric fields
Problem with VFP Numeric fields
Iniciado por Dennis, 15,ene. 2021 22:15 - 1 respuesta
Publicado el 15,enero 2021 - 22:15
Hello,

I want to migrate a huge Foxpro application and I am looking into WINDEV. After spending some hours trying things out, I ran into one problem I could not solve.
Because I want to transition in parts, I have to work with the VFP database. I use the VFPOLEDB driver and reading and writing works fine except when my WHERE condition contains a numeric field:

wSQL is SQL Query =
[
SELECT * FROM USER WHERE id = 3
]
HExecuteQuery(wSQL,hQueryDefault)


If the fieltype "id" is an integer it works. But if it's type is numeric(2,0) then the result is as if the 3 is a 0. So I get the record from user with the id 0. Same is when I use "where id > 3", I get all records with id > 0 and with "where id < 3" I get records with id < 0.

This returns nothing:
HExecuteQuery(wSQL,hQueryWithoutCorrection)


This returns the correct value:
HExecuteQuery(wSQL,MyCon,hQueryWithoutCorrection)


Can someone explain this to me why it works withoutout naming the connection when the field is an integer, but when the fiels is numeric, I have to name the connection and also use the parameter?

It seems like windev is altering the query in a way that the database can not handle the comparison.
Is there a way I can see what the query looks like that WINDEV is sending to the database?

Thank you all.
Publicado el 17,enero 2021 - 16:07
I figured it out:
Changing the field format in the analysis from "decimal (WLanguage numeric), integer part: 3, decimal part:0" to "integer, format 999" worked.

I also had problems when modifying a record with a logical (boolean) field. Changing it in the analysis from "boolean" to (integer, format 9) worked, too.

I don't know if this is the best approach, because I have to change a lot of fields in the analysis, but it is the only way I got it working.