devxlogo

FoxPro Commands and the ODBC Driver

FoxPro Commands and the ODBC Driver

Question:
I’m trying to set up an SQL call (in ColdFusion) to a program (TESTOUT.PRG) that uses the FoxPro COPY TO command and user-supplied parameters to output the desired file type:

 SELECT testout('USER','XLS') as test FROM MyTableWHERE user='USER'

It doesn’t work. The driver (ver. 6) reports “Feature not available,” yet the command is listed as available in the driver help file.

Help! I really need to provide this feature to my users. Are there any alternative solutions?

Answer:
The ODBC driver cannot execute FoxPro programs (which is what testout() is); that is why the feature is unavailable. I am not very familiar with ColdFusion but I would bet that you could create a VFP COM server that you could pass an ID to generate as a file:

 x=createobject("MyServer.TestOut")SELECT id ;    FROM MyTable ;    WHERE User="USER"    INTO ARRAY laUsersFOR I = 1 TO ALEN(laUsers,1)        x.Convert(laUsers[I],"USER","XLS")ENDFOR

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist