Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2008, 09:03 PM
Registered User
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to link FoxPro Table with VB

Hi all,

Could you please help me in finding a way to connect to a foxpro table from VB, my table is with .dbf extension and not .dbc. Also I am trying to understand how to use the: dataAdapter, DataSet and GridView to can display all the records of that table inside a VB Windows form.

Thanks.

 
Old September 21st, 2008, 12:30 PM
Authorized User
 
Join Date: Nov 2006
Posts: 31
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via ICQ to debasisdas Send a message via AIM to debasisdas
Default

i believe you are not using VB 6.0

Regards
Debasis
 
Old September 14th, 2009, 09:26 AM
Registered User
 
Join Date: Sep 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

VFPOLEDB.1
Code:
    Dim sFolder As String:          sFolder = App.Path
    Dim sTable_ As String:          sTable_ = "base_fox"    ' base_fox.dbf
    
    Dim cnn As ADODB.Connection:    Set cnn = New ADODB.Connection
    Dim rst As ADODB.Recordset:     Set rst = New ADODB.Recordset

    cnn.Provider = "VFPOLEDB.1"
    cnn.Properties("Data Source") = sFolder                 ' or   sFolder & "\" & bas_fox.dbc
    cnn.Open
    rst.Open "SELECT * FROM " & sTable_, cnn
    If Not rst.EOF Then
        MsgBox rst.Fields(0)
    End If
    
    rst.Close:  Set rst = Nothing
    cnn.Close:  Set cnn = Nothing





Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking to a Foxpro Table DavidWE Access VBA 0 July 18th, 2008 02:26 PM
Link FoxPro tables through OLEDB catudalg Access 2 May 8th, 2007 08:16 AM
Exporting Oracle Table to .dbf (FoxPro 2.6) File syamchandr Oracle ASP 2 December 12th, 2005 04:43 AM
How to use foxpro dbf with vb cbpanchal VB Databases Basics 2 November 13th, 2004 11:48 AM
Update SQL table with data from FoxPro system sofya SQL Server 2000 6 November 4th, 2004 06:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.