How to read and write dBASE, FoxPro, Visual FoxPro and Clipper files from modern C# without the 32-bit OLE DB or Jet drivers, and without breaking the legacy app that still uses the same files. Includes the crash, power-cut, code-page and speed tests against Visual FoxPro 9.
Read the full write-up: Reading and writing dBASE and FoxPro files in modern .NET
Chapters
- 0:00Intro
- 0:30The 32-bit driver problem
- 1:00What Thunder.Dbf is
- 1:42Sharing files with a program from 1995
- 2:26Reading a table in C#
- 3:02Proving it against the real programs
- 3:42Many programs on one table
- 4:19Other languages and code pages
- 4:48A writer killed mid-write
- 5:30Power cuts and damaged files
- 6:03How fast it is
- 6:32Writing speed and the safe default
- 7:11From reading the data to moving off it
- 7:51Get it
Shorts from this video
Your business still runs on dBASE files. Now what? (0:30)
FoxPro indexes in 11 code pages, byte for byte (0:29)
50 hard power cuts while writing dBASE files (0:33)
Kill a FoxPro write mid-change: who leaves a silent bad index? (0:41)
49x faster DBF lookups than the VFP OLE DB driver (0:30)
Transcript
Intro
A surprising amount of business still runs on dBASE and FoxPro files. GoldMine keeps its contacts in them. So do older accounting and inventory systems, Siemens STEP 7 projects, and every GIS shapefile. The programs that write those files are often decades old, and they still work. That's exactly why nobody has replaced them. In this video, we'll look at how to read and write those files from modern .NET, without breaking the old program that still depends on them.
The 32-bit driver problem
The trouble starts when a modern system needs the same data. Microsoft's Visual FoxPro OLE DB driver and the Jet dBASE driver are 32-bit only, and neither one is being developed anymore. So every .NET app that talks to these files ends up pinned to an x86 build, and to a driver nobody maintains. Reading the files is the easy part. The hard part is writing to them while the old program is still running, without breaking its indexes or its locks.
What Thunder.Dbf is
That's the problem Thunder.Dbf solves. It's a free, MIT-licensed C# library. It reads and writes dBASE, FoxPro, Visual FoxPro and Clipper tables, memos and indexes, in plain managed code. It runs on .NET 10 and .NET 11, on Windows, Linux and macOS, with no ODBC, no OLE DB, no Jet, and no 32-bit process. And on Windows and Linux, it keeps the legacy app's indexes and locks intact, so the old program can keep running on the same files.
Sharing files with a program from 1995
Old xBase programs don't use a database server. Each copy of the app opens the same files on a shared drive, and they coordinate through byte-range locks and the index files themselves. Anything else that writes to those files has to play by the same rules, or the old app finds a corrupt index the next morning. Thunder.Dbf takes the same record and header locks that dBASE takes, and on dBASE and Clipper indexes it updates every tag on every write. Keeping FoxPro's own index files current is in preview, and you opt in to it. Fields you didn't change stay byte for byte as they were. And it opens files read-only unless you ask otherwise, so pointing it at live data just to look around is safe.
Reading a table in C#
Here's what that looks like in code. You add one NuGet package. You open the folder that holds the tables. A check tells you what's readable, writable, locked or damaged before you touch anything. Then you loop over a table, here GoldMine's contact table, and skip the records marked as deleted. You can also find a record through the app's own index, the same way dBASE's SEEK command does. Values come back as ordinary .NET types, like string, decimal, DateOnly and bool. To write, you open the database with read-only turned off.
Proving it against the real programs
Unit tests prove a library agrees with itself. The question that matters is whether the old program still trusts the files afterward. So we ran Thunder.Dbf against the software it actually shares files with: Visual FoxPro 9, the VFP OLE DB driver, the Jet and ACE Access drivers, and Harbour, the open-source Clipper. First, Thunder.Dbf and Visual FoxPro took turns on the same tables for twenty rounds, then wrote at the same time. That came to more than six hundred thousand writes and thirty-nine million index entries and records checked, and every one agreed.
Many programs on one table
Next, we simulated a busy office. Four Visual FoxPro programs, ten OLE DB connections, and six Thunder.Dbf writers all hit the same table for sixty seconds at a time, adding records, changing keys, deleting and recalling. We ran it on four kinds of table, on a local disk and over a network share. Every time, every record added was counted, Visual FoxPro found every key, and every index matched a fresh rebuild. One run alone added six hundred and fifty thousand records with nothing lost.
Other languages and code pages
FoxPro tables in other languages use other code pages, and an index built in the wrong one is useless to the old program. So we had Visual FoxPro build tables of random text in eleven code pages, from Western and Central European to Cyrillic, Greek, Turkish, Baltic and Japanese. In all eleven, Thunder.Dbf's index keys were byte-for-byte identical to Visual FoxPro's, including case-insensitive upper-case indexes.
A writer killed mid-write
The harshest test for a shared file is a writer dying halfway through a change, the way a program does when someone closes a laptop lid. What matters isn't whether damage happens, since no file format can promise that. It's whether anyone finds out before the old program starts trusting a broken index. We killed each writer at a random moment, sixty times, and then let Visual FoxPro judge the table with its own tools. Visual FoxPro and its OLE DB driver left a wrong index with no warning fifty-one times in a hundred and eighty. Thunder.Dbf never did. Every time something was wrong, it said so, and refused to write until it was fixed.
Power cuts and damaged files
A killed program still leaves the operating system to finish its writes. A power cut doesn't. So we switched off a virtual machine, hard, at a random moment while Thunder.Dbf was writing. Fifty times in each mode. On its default settings, it never lost a write it had confirmed, and in no mode did it leave damage it didn't report. Then we fed it two hundred thousand deliberately corrupted tables and indexes. In the final hundred thousand, every damaged file got a plain error that explains what's wrong, not a raw exception.
How fast it is
Now, speed. Most teams that come to Thunder.Dbf are leaving the Visual FoxPro OLE DB driver, so we timed both on the same PC, on the same tables. Reading is where the gap is widest. Thunder.Dbf found records by key forty-nine times faster than the driver, about seventy-seven thousand lookups a second against about sixteen hundred. It also read a whole ten-thousand-row table two point eight times faster.
Writing speed and the safe default
Writing is closer, and it depends on how many index tags each write has to keep current. With nothing forced to disk, which is how Visual FoxPro and its driver always write, Thunder.Dbf added records forty-five percent faster than the driver on a table with two index tags. On a table with seven tags, it ran about eight percent behind the driver, and Visual FoxPro itself was faster still. Out of the box, though, Thunder.Dbf forces every write to disk, in the order that makes those crash results possible. That's slower, and it's the safe end. Full speed is one setting away, and you choose it per table.
From reading the data to moving off it
Most teams don't stop at reading. Companion packages cover the usual next steps. You can query with your own C# classes through a LINQ provider that uses the app's indexes when it can. You can keep existing ADO.NET code, with a connection, command and data reader that replace the 32-bit drivers. You can copy a whole folder to SQL Server, PostgreSQL or SQLite, or keep a live table and its SQL twin in step, both ways, until you cut over. And there's a command-line tool, plus a JSON web API with API keys or OpenID Connect, per-table and per-field permissions, and backups.
Get it
Thunder.Dbf is free and MIT-licensed, including for commercial use. It's on NuGet, and the source is on GitHub. We built it out of our own client work: keeping an old system running while the business moves to something new. If you're facing a move like that, the full write-up and the test details are on projectthunder.com. Thanks for watching.
Narration is an AI voice (Azure). The facts come from the linked write-up.


