CAST Problem using ADO

I'm trying to retreive a character field as a numeric from a FoxPro free table using ADO inside Visual Basic code. The query:

"Select A, Cast (B as numeric) from c:\test.dbf"

yields the following error message:

Function name is missing ).

Any ideas



Answer this question

CAST Problem using ADO

  • GreyGallon

    Just to add, the latest FoxPro and Visual FoxPro OLE DB data provider is downloadable from msdn.microsoft.com/vfoxpro/downloads/updates. The most recent ODBC driver is there also, but you're much better off using OLE DB.

  • Jonathas Oliveira

    In addition to Cetin's siggestion I think you have to specify the domain in detail in a CAST():

    Thus: CAST( B AS Numeric(10,2))

    There is a table in the VFP Help file topic on CAST() which shows which data types take Width/Precision values ad Numeric is certainly one of them.



  • sameerTripathi

    I think you're using an old version of VFPOLEDB driver. cast() is new to VFP9 and you should be uisng latest VFPOLEDB driver for it to work.
  • CAST Problem using ADO