Link to home
Start Free TrialLog in
Avatar of Pra4444
Pra4444Flag for United States of America

asked on

visual c# dataset to a DBF file

Does anybody know how to convert a dataset from .net to a .DBF file so that it can be accessed later by say a foxpro??     I couldnt find any examples online and all i could find was converting in into a binary...
I am using visual C#. however i am ok with a vb.net example as well , if somebody has done that..

Thanks.
Avatar of theplonk
theplonk
Flag of Australia image

Add a Access Object Library COM reference to your solution.
Then you can create a new access database by (you will just need to translate into c#):

Dim Access As New Microsoft.Office.Interop.Access.Application
Access.NewCurrentDatabase("f:\test.mdb")
Access.Quit()

After this you can just use your usual oledb data connections or whatever form you would normal use to connect to an access database.
With oledb just use the OleDbDataAdapter.Fill (DataTable) method. If the table does not exist in the access database, it will create it. Similarly you could use DataSet instead of DataTable, but you may not want to do a full DataSet.
ASKER CERTIFIED SOLUTION
Avatar of Priest04
Priest04
Flag of Serbia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pra4444

ASKER

Yes I think you are right priest04. I searched everywhere and i think i am going to follow the 2nd method..i have downloaded the oledb provider for foxpro..and was able to construct a simple sql ddl and get what i want..thanks a lot...i was kind of hoping someone might have done that before, but apparently no one did or atleast no one posted an example online...
I am glad I could help.

Goran