display data in datagridview form dbf file

Posted on 2009-02-09
Last Modified: 2013-11-18

VSexpress 2008 VB

I create datagridview1  in form1 and I want to display data from fox database file dbf in this datagridview

file is on P:\PROGRAMS\Ex\y2008

I'm beginner and know that this code is wrong but this is what i get searching in google and experts exchange

thanks in advance

Dim con As New OleDbConnection("Provider=SQLOLEDB;Data Source=P:\PROGRAMS\Ex\y2008 ;Extended Properties=dBASE IV;User ID=ccc;Password=hhh;")

        Dim da As New OleDb.OleDbDataAdapter()

        da.InsertCommand = New OleDbCommand("hgascalcstored", con)

        With da.InsertCommand

            .CommandType = CommandType.Text

            da.InsertCommand.CommandText = "use invprn"

            da.InsertCommand.CommandText = "browse"


end sub

Open in new window

Question by:gowerman
    LVL 14

    Accepted Solution

    Is this a visual foxpro or a dBase database file. For Visual Foxpro, the provider should be VFPOLEDB and not SQLOLEDB. Also username and password is not implemented in VFP.

    Author Comment

    ok I change that but still have error on line


    I think with this command i don't get data from database but just display  browse

    problem is i dont know what is command to retrieve  data
    LVL 12

    Expert Comment

    If you are looking for code/syntax for   VSexpress 2008 VB   then you are posting your question to the wrong forum.    

    Once you get the FP/VFP data it is up to that language's command set to display the data.

    This is a forum for Foxpro/Visual Foxpro - not  VSexpress 2008 VB

    Perhaps you should post your question to a forum dealing with that language.

    Good Luck


    Author Comment

    ok I will post that to VS express
    I'm beginner but when i was connected to sql then after i use sql command to get data
    I connect to server no i dont know how to display this data in datagridview
    LVL 6

    Expert Comment

    The below attached code will connect to your dbf file and give a message data from your dbf first col.

    Make necessary changes at your end like path and file name and link your form with recordset etc and try .

    Best of luck ....

    Bm keshav


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Read about how to choose the best possible content marketing agency to suit your needs. Content marketing has become an integral part of running a successful tech business, so it is wise to be informed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now