FoxPro for C #: What is the best method between ODBC, OLE DB or others?

We need to read data from FoxPro 8 with C #. I am going to perform some operations and pop some thoses data into the SQL Server database. We do not know what is the best way to read this data.

I saw OLE DB and ODBC; what's better?

REQUIREMENTS:

  • The export program will run every night, but my company works around the clock.
  • DBF can sometimes be huge.
  • We do not need to change the data.
  • Our system using FoxPro is quite unstable: I need to find a way to ABSOLUTELY not mess up the data, and, ideally, not block DBF files while reading.
  • Speed ​​is a minor requirement: it must be fast, but requirement No. 4 is the most important.
+4
source share
4 answers

I would use the OLEDB connector - it has been updated recently, faster and better copes with memory.

If you just read data from DBF through the OLEDB driver, I would not worry about locking at the write or file level or data corruption. All you have to do is handle exceptions in C # code, for example, when some process in your FoxPro DBF application is open exclusively and you cannot read it.

You also need to be careful that any queries are optimized to use the available indexes in the DBF file, especially since you mention that it is large.

I assume this is all on the same LAN? If it should work over the Internet, you need to investigate the publication of FoxPro data through a web service.

Finally, there are other options for accessing DBF files.

Sybase also provides ODBC and OLEDB drivers that can access DBF files β€” however, they cannot use FoxPro triggers, stored procedures, etc. It almost certainly does not matter in your case.

+5
source

In accordance with this MSDN article, it is suggested that you use the Visual FoxPro OLE DB provider. Take a look at an article that provides examples of using the OLE DB provider and how to query data from a DBF data source.

+2
source

It is also quite easy to write some code in VFP that will upload the data in CSV or XML - consider adding this code to a FoxPro application. Processing these files can be a lot easier than trying to connect to the flaky FoxPro database.

0
source

Codeplex has the LinqToVfp tool. See: http://linqtovfp.codeplex.com

He has some good samples to help you get started.

0
source

Source: https://habr.com/ru/post/1436177/


All Articles