How to connect to FoxPro Free Tables using VB 6 
Author Message
 How to connect to FoxPro Free Tables using VB 6

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



Fri, 03 May 2002 03:00:00 GMT  
 How to connect to FoxPro Free Tables using VB 6
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


Quote:
> 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



Fri, 03 May 2002 03:00:00 GMT  
 How to connect to FoxPro Free Tables using VB 6
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.


Quote:
> 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



Thu, 09 May 2002 03:00:00 GMT  
 How to connect to FoxPro Free Tables using VB 6
On Mon, 15 Nov 1999 15:06:29 +0100, "Gerhard Kittel"

Quote:

>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



Sun, 19 May 2002 03:00:00 GMT  
 How to connect to FoxPro Free Tables using VB 6
Thank you Naldo!  Exactly what I was looking for too!  Works beautifully!

Gary in Atlanta


Quote:
> 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.



> > 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



Sat, 27 Jul 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How to connect to FoxPro Free Tables using VB 6

2. FoxPro 2.x Free Table/Not using Index

3. ADO and FoxPro Free Tables in VB

4. ADO and FoxPro Free Tables in VB

5. Connecting VB to Visual Foxpro 5.0 Tables

6. Using FoxPro 3.0 tables in VB using ADO

7. connecting to visual foxpro table thru vb 6

8. VB can't connect to a Foxpro database using MDAC under W2K

9. Using VB read FoxPro table

10. Newbie: FoxPro free table access

11. Reading Foxpro Free Table

12. Connecting ADO Datacontrol and Datagrid to Foxpro Table

 

 
Powered by phpBB® Forum Software