0

I am trying to connect to a DBF (HISTORY.DBF) that has a linked SMT file (HISTORY.SMT). I have multiple DBF files and I can connect to all of them except the ones with SMT files.

Looking at the header information of the DBFs suggests it is a Clipper (E5 Header) format DBF which reads fine using the connection code below for most files, but once I try to read a file with an associated SMT it fails with the fault:

External table is not in the expected format

My Code is as below

Dim dsDataSet As New DataSet
Dim ConnectionString As String
Dim daDataAdapter As OleDb.OleDbDataAdapter
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection

Dim strFilePath As String = gloStrPath & "data"
Dim strDBF As String = "HISTORY.DBF"

Try
    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFilePath & ";Extended Properties=dBase III;"
    dBaseConnection = New System.Data.OleDb.OleDbConnection(ConnectionString)
    If dBaseConnection.State = 0 Then dBaseConnection.Open()
Catch ex As Exception
    MsgBox(ex.Message, 16, "Error")
End Try

Try
    daDataAdapter = New OleDb.OleDbDataAdapter("select * from " & strDBF, dBaseConnection)
    daDataAdapter.Fill(dsDataSet, "Name")
Catch ex As Exception
    MsgBox(ex.Message, 16, "Error")
End Try

Can anyone offer any insight into what I am doing wrong or what I am missing?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
idaBigA
  • 1
  • 1
  • I have done some more messing around and found that if I change the header information from e5 to 03 (Clipper to dBase III) then I can load the data fine using vb.net. it means making a copy of the DBF and editing the first byte, but it gets me where I need to be. – idaBigA Nov 04 '20 at 08:53

1 Answers1

0

These files appear to be DBFs that were created with the HiPer-Six format with SMT memo files. Check this https://www.dbf2002.com/dbf-file-format.html

Gerry B
  • 1
  • 1