We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

display data in datagridview form dbf file

Medium Priority
1,377 Views
Last Modified: 2013-11-18
Hi

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"
 
DataGridView1.DataSource.Equals(da.InsertCommand.CommandText)
 
end sub

Open in new window

Comment
Watch Question

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.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
ok I change that but still have error on line


DataGridView1.DataSource.Equals(da.InsertCommand.CommandText)

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

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

Commented:
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
CERTIFIED EXPERT

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

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.