Question

We commonly use MS Visual Foxpro v9.0 SP1, the language, tables, and reports. However, sometimes we use an ODBC driver to connect to the tables. The ODBC driver was written for Foxpro v6, and doesn't support certain nested selects, autoincrement fields, or embedded casts.

We would like to find an alternative to what we have. It could be another ODBC driver that works with Visaul Foxpro v9, or a complete alternative to ODBC. Is there such a thing?

Thanks.

Was it helpful?

Solution

(Talk about reuse, just answered this in another thread today)

If you are looking for an ODBC driver for VFP databases and tables you might consider looking at Advantage Database from iAnywhere. The have a local engine and a server engine. The local engine has the engine to access DBF data, but for your case, it also has an ODBC drive that works with VFP data up to and including the current Visual FoxPro 9. The local engine and the included ODBC driver are free.

http://www.sybase.com/ianywhere

OTHER TIPS

You can via COM+ and do almost anything in VFP, however, you have security issues through Admin Tools, Component Services..

You can either build as a single-threaded or multi-threaded DLL.

Once registered, and the typelibrary info is "Add Referenced" to a C# (or other) app, you can make function calls with whatever parameters you need. There are many things you can return back, but typically tables, I send back as XML (via Foxpro's XMLAdapter class), then stream convert to a table once in C#. Its been a while since I worked it that way, but that give tremendous flexibility as you can do your queries, scan loops, and other complex conditional testing and updating of the cursor before generating out the XML and returning it as a string.

DEFINE CLASS YourClass as CUSTOM  OLEPUBLIC
  FUNCTION GetMyData( lcSomeString as String)
    select * from (YourPath + "SomeTable" ) where ... into cursor C_SomeCursor readwrite
    .. any other manipulation, testing, etc...
    oXML = CREATEOBJECT( "xmladapter" )
    lcXML =  ""
    oXML.AddTableSchema( "C_SomeCursor" )
    oXML.ToXML( "lcXML", "", .f. )

    return lcXML
  ENDFUNC 
ENDDEFINE
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top