VBS accessing foxpro db/tables via odbc 
Author Message
 VBS accessing foxpro db/tables via odbc

I have been given a task to write a stand-alone vbs which will, among
other things, access a foxpro db & a separate foxpro table.  What is the
simplest way to do this, and can anyone give me some sample code?  I
have tried the same syntax as VBScript code as used in an ASP page, but
it does not work.


Carlin Anderson

Sun, 02 Oct 2005 18:47:16 GMT  
 VBS accessing foxpro db/tables via odbc

Suppose you have a VFP database named data1.dbc located in c:\MyDBC folder
and it has a table named Table1, you can use the following VBS code to
access the table through {Microsoft Visual FoxPro Driver}.

  Dim conn
  Dim rs

  Set conn = CreateObject("ADODB.Connection")
  conn.ConnectionString =
"SourceType=DBC;SourceDB=C:\MyDBC\data1.dbc;Driver={Microsoft Visual FoxPro

  Set rs = CreateObject("ADODB.Recordset")
  rs.CursorType = 3
  rs.LockType = 3
  rs.Open "Table1", conn, , , 2

  Wscript.Echo rs.Fields(0).Value

  Set rs = Nothing
  Set conn = Nothing

If you want to access a free table named Table1 under c:\MyDBF folder, you
can change the connection string as follows:
  conn.ConnectionString = "SourceType=DBF;SourceDB=
C:\MyDBF;Driver={Microsoft Visual FoxPro Driver}"

In addition, please make sure {Microsoft Visual FoxPro Driver} is installed
properly on the machine. You can check the [Drivers] tab in ODBC Data
Source Administrator to see if it is installed. Here is the download
information about Microsoft Visual FoxPro Driver:

Elan Zhou
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com

Tue, 04 Oct 2005 10:10:32 GMT  
 [ 2 post ] 

 Relevant Pages 

1. ASP reading Access DB with linked Foxpro tables, not working

2. Packing a FoxPro table via ODBC.net from VB.net

3. Need help creating Fox 2.5 table via MS Visual FoxPro ODBC driver

4. Linking Access 97 to Visual Foxpro 3.0 via ODBC

5. Access Foxpro table Via ADO(VB)

6. Create table at Access DB via vbscript

7. Visual Basic App using Foxpro DB vs Access DB vs SQL Server DB

8. Visual Basic App using Foxpro DB vs Access DB vs SQL Server DB

9. Access Oracle 7 DB on WinNT via ODBC

10. Hit Access 2.0 DB via ODBC (VB4)

11. Hit Access 2.0 DB via ODBC (VB4)

12. Accessing DB via Oracle odbc driver


Powered by phpBB® Forum Software