Kris Krause .NET Meister

"If it is fast and ugly, they will use it and curse you; if it is slow, they will not use it."
- David Cheriton, The Art of Computer Systems Performance Analysis

Wednesday, February 02, 2005

Parsing dBase .DBF to .CSV Using C# and VB.NET

Per a New Jersey Microsoft Developer's Group message board request I created a sample console application that parses a .DBF file and creates an Excel usable .CSV file. Zero magic if you take advantage of the System.Data.Odbc namespace.

The command line syntax is:

FPParse.exe [table name] [output dir]
FPParse.exe canada c:

The generated .CSV file is just as good as an .XLS file. For fancy .XLS features and formatting I suggest modifying my code to utilize Excel COM Interop.

The C# source code is found here.

The VB.NET source code is found here.

Labels:

4 Comments:

  • The column names are hard coded in the program. However, if you open a DBF file in Excel, it knows the column names, so they must be there in the file.

    By Blogger Chuck Esterbrook, at 6:36 PM  

  • This code can handle a lot of DBF files or just one? Cuz I have a lot :(
    If you can help me: tintasbarnes@gmail.com
    And usually I develop in Visual Studio...

    By Anonymous Anonymous, at 9:23 AM  

  • The links for source code are not working. Is the source still available?

    By Anonymous Al, at 9:25 PM  

  • The links for the source are not working. Is the source still available somewhere? Thanks.

    By Anonymous Anonymous, at 9:27 PM  

Post a Comment

<< Home