0

I want to use FoxPro database in backend and c# .net in front end but i don't know how to connect with foxpro database in .net

For connectivity what code i use, please suggest...

Shoeb
  • 652
  • 9
  • 17
  • google ado.net or check this http://msdn.microsoft.com/en-us/library/ee382825.aspx – rs. Dec 25 '12 at 14:32
  • 1
    possible duplicate: http://stackoverflow.com/questions/4049891/how-do-i-read-a-foxpro-8-0-database-from-c – Saw Dec 25 '12 at 14:44
  • http://www.c-sharpcorner.com/uploadfile/ankurmee/import-data-from-foxpro-dbf-database-to-datagridview-in-C-Sharp/ – Karthik Dec 25 '12 at 15:03

2 Answers2

0

You may want to look at .Net Interop.

Also take a look at West-Wind web connect. They have a framework that allows you to use the Visual studio IDE to create webforms but also use your VFP business logic and data source. This works well.

West wind also has a wwDotNetBridge that allows you to access .Net components from VFP.

Check out their website below.

http://west-wind.com/WestwindClientTools.aspx http://www.west-wind.com/presentations/VFPDOTNETiNTEROP/VFPDOTNETINTEROP.HTM

Jerry
  • 6,357
  • 8
  • 35
  • 50
  • Dear Jerry, I have Visual Studio 2010 IDE in front end and FoxPro Database in backend. I have to connect with FoxPro database for selecting some data from. I am new with FoxPro, I don't know what code I use to connect with FoxPro Database. I have only knowledge to connect with SqlServer...Help Please... – Shoeb Dec 26 '12 at 09:39
  • Here is an link that describes how to connect to foxpro data from .net: http://msdn.microsoft.com/en-us/library/aa977092(v=VS.71).aspx Also, here are a couple connection strings examples: Free table directory: Provider=VFPOLEDB.1;Data Source=C:\SomeDirectory\MyVFPDataFolder;Password="";Collating Sequence=MACHINE Database Container: Provider=VFPOLEDB.1;Data Source=C:\SomeDirectory\MyVFPDataFolder\MyVFPDataBase.DBC;Password="";Collating Sequence=MACHINE – Jerry Dec 27 '12 at 18:05
0

I don't think you necessarily need to go the way of "interop", but get a basic understanding of connecting and querying data.

First, get Microsoft's OleDB provider located here

Here is a sample doing a connection and running a simple query to get data but this one sends the results to another VFP table instead of bringing back to C# for process/usage.

This example shows Inserting records and uses parameters to help prevent any attempts at SQL-injection attacks

And another using SQL-Update

Once you get the basics down, its not that difficult. I've actually made a simple "wrapper" class to centralize ensuring a valid connection, execute a given query and closing connection when done. Then, I've just added methods to it for each thing I wanted to do (or could be subclassed too). Anyhow, when I need to do a certain action, I would just call that function and pass in whatever parameter(s) was(were) needed.

Community
  • 1
  • 1
DRapp
  • 47,638
  • 12
  • 72
  • 142