Steve Chadbourne
Steve Chadbourne

Reputation: 6953

How to open a .DBF file with a .DAT extension

I need to open a dbase III file in C#. The sticking point is that the file has a .dat extension not a .dbf. I have tried both OleDB and Odbc and both require that the file has a .dbf extension.

Renaming the file is not an option. These come from a customer as part of a GIS TAB file set.

Any ideas?

Upvotes: 2

Views: 1241

Answers (2)

Serge
Serge

Reputation: 6095

If the file resides on writable NTFS volume you could establish hard link to this file: Fsutil: hardlink

Upvotes: 0

DRapp
DRapp

Reputation: 48139

I know that the the OleDB connection can point to a "path" where the data resides... However, I think you can explicitly qualify the file name to include the .dat such as

select * from YourTable.DAT where SomeCondition;

your typical query would have been

select * from YourTable where SomeCondition;

and the OleDB provider would IMPLY a ".dbf" extension. However, since you are explicitly qualifying as .DAT, it should find it for you. Additionally, via OleDB, you can actually query from sub-folders from a common root (just FYI).

Upvotes: 1

Related Questions