VS C# dbf files

I have a collection of dbf files that I wanted to import into SQL. Using the import task in SQL every time I I point to any of these files, I am able to see the table names but when I zero in on any one file I get the message that file is not of the correct type. ("External table is not in the expected format"). I have tried downloading dbf file tools and they all come back with similar messages. I am wondering that perhaps whatever is creating these files is doing something with the file headers to make them invalid. My thought right now it to create a VS C# application in which I will then parse each record and extract out what I need. What should I use in the connection string for these files that will allow me to parse each character and determine where one field ends and the next begins as well as the end of record? Would it be better to specify a dbf type file? Is there a connection string parameter that can be used to specify that? How do I read dbf files using VS C#?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

James ShinevarMIS OfficerCommented:
What is the source of these dbf files?  Are they from FoxPro?  What version of SQL Server are you looking to import them to?  Is it 32 or 64 bit?  Sorry to drop a lot of questions, I'm actually in the middle of a FoxPro to SQL Server conversion right now.
rwheeler23Author Commented:
We are using SQL 2012. I have been given these dbf's that are generated by a third party product with no support. I threw every dbf reader I could find and none of them could read them. The ISV product can read them. That is why I know want to write a VS C# program just so I go character by character to see what is in the file. I did find one file called Dbase Runtime Edition.
James ShinevarMIS OfficerCommented:
hmmm... so they are probably dbase files then.  I hate to plug a solution that requires a purchase, but this is what I ran into: we had FoxPro dbf files and SQL Server 2014 x64.  There is no "driver" or direct solution to migrate FoxPro to SQL Server 2014 x64.  If I had a SQL Server 2005 32bit server, my FoxPro drivers would have allowed me to make an ODBC connection and import the tables.  Since I didn't have that as an option, I used a solution from DBConvert https://dbconvert.com/download.php .   I downloaded the trial and when I saw it could convert within the limitations of the trial program (meaning not all the rows), I purchased the solution.  Perhaps one of their solutions will work for you.  It's worth a try, even while looking for a free alternative.
SolarWinds® Network Configuration Manager (NCM)

SolarWinds® Network Configuration Manager brings structure and peace of mind to configuration management. Bulk config deployment, automatic backups, change detection, vulnerability assessments, and config change templates reduce the time needed for repetitive tasks.

James ShinevarMIS OfficerCommented:
I have also read that it may be possible to import the dbf to Access and then import your access database to SQL Server, that might be a way to try.
rwheeler23Author Commented:
That is true, but I need to automate the transfer as it will be occurring daily. My first desire would have been to create an SSIS package but that is off the table now.
Can you open the DBF's in Excel?
rwheeler23Author Commented:
No. I get the same message. External file is not of the correct format. I did find something called Dbase 9. This is the only file I found that could read these files.
Going back to your original plan to build a program to parse the file, the DBF header record contains, among other things, the names, types, lengths, etc. of the fields in the table.  The structure of the header record is fully described in the VFP documentation.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwheeler23Author Commented:
I will use an export tool that is able to read these files. Thanks for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.