Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to connect to FoxPro Free Tables using VB 6

426 views
Skip to first unread message

Gerhard Kittel

unread,
Nov 15, 1999, 3:00:00 AM11/15/99
to
How can I open a FoxPro 6 Free table using VB6 for writing purposes?
Is there some sample code on the net that I could look at?

Thanks

Gerhard

Scott Dinwiddie

unread,
Nov 15, 1999, 3:00:00 AM11/15/99
to
Hi Gerhard.

It is my understanding that VFP does not have an OLEDB provider, so that
means setting up an ODBC connection to use with ADO....

When you choose the VFP driver, it will ask you whether or not you want to
create a DSN with a VFP database or with a free table directory. If you
choose free table directory you just type in the path to where your tables
are stored. Then your recordset can be as simple as "select * from
tablename".

Once you get the ODBC DSN setup you can access the data with ADO pretty much
like you would Access or SQL Server.

At one point, a gentlemen by the name of John Peterson had a white paper on
ADO on the Microsoft web site. He has a background in VFP so I'm sure that
his paper talks about the ODBC connection.......

Hope this helps.

Scott


Gerhard Kittel <gerhard...@exact.nl> wrote in message
news:80p3va$3sk$1...@fleetstreet.Austria.EU.net...

Naldo

unread,
Nov 21, 1999, 3:00:00 AM11/21/99
to
Some time now I'm using the Microsoft Visual Foxpro Driver out of VB with
ADO.

How I did it :

' open connection
Dim strconnect As String
strconnect = "Driver=Microsoft Visual Foxpro Driver;
SourceDB=C:\TESTDBFPATH; SourceType=DBF; Exclusive=No; BackgroundFetch=No;
Collate=Machine; Null=No; Deleted=Yes;"
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open strconnect
cn.Execute "SET REPROCESS TO 10 SECONDS"

' just check some items concerning the provider ...
Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT VERSION() as VERSION, SET(""DATE"") as
DATEFORMAT, SET(""HOURS"") as HOURFORMAT FROM TESTTABLE")
Debug.Print rs("VERSION")
Debug.Print rs("DATEFORMAT")
Debug.Print rs("HOURFORMAT")
rs.Close

' open recordset and make modification on first record of table
set rs = new adodb.recordset
dim strsql as string
strsql = "SELECT * FROM TESTTABLE"
rs.open strsql,cn,adopendynamic,adlockpessimistic
if not rs.eof
rs("FIELDNAME1")="TestValue"
rs("FIELDNAME2")="TestValue"
rs.update
endif

Testdbfpath is the path where all the freetables are located.
Testtable is a free table.

You will see that the performance through this ado provider is comparable to
VFP or FPD26. It's nice to feel VFP performance under VB.

Regards,
Donald.

Phil Jones

unread,
Dec 1, 1999, 3:00:00 AM12/1/99
to
On Mon, 15 Nov 1999 15:06:29 +0100, "Gerhard Kittel"
<gerhard...@exact.nl> wrote:

>How can I open a FoxPro 6 Free table using VB6 for writing purposes?
>Is there some sample code on the net that I could look at?
>
>Thanks
>
>Gerhard
>
>

We access Fox tables via ODBC in the same way as we would a Jet
database.

Most of our systems work - BUT - we have a problem in 1 module where
we get an Out of Stack Space error on the Execute of an INSERT new
record. This is driving us nuts - the problem appears to be in the
Fox odbc driver but we can't get past it.

Have you any experience of similar ?


Phil Jones

Gary Coombs

unread,
Feb 8, 2000, 3:00:00 AM2/8/00
to
Thank you Naldo! Exactly what I was looking for too! Works beautifully!

Gary in Atlanta

Naldo <donal...@skynet.be> wrote in message
news:uKQcR5BN$GA....@cppssbbsa02.microsoft.com...

0 new messages