hemant037
hemant037

Reputation: 11

Getting error while connecting .dbf to c#. Error is External Table is not in the Expected format

OleDbConnection c= new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Folder; Extended Properties=dBASE IV;");
c.open();
OleDbDataAdapter da=new OleDbDataAdapter("Select * from Table11",c);
DataSet ds=new Dataset();
da.Fill(ds);
c.Close();

I was trying to read .dbf table from c# and I have write above code for it, but I am getting this error:

External Table is not in Expected Format

Upvotes: 1

Views: 1181

Answers (2)

Ailis
Ailis

Reputation: 177

static string connStr ="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Folder\sample.xlsx; Extended Properties=dBASE IV;";

Upvotes: 0

Soner Gönül
Soner Gönül

Reputation: 98750

Try like this;

public static string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Folder; Extended Properties=dBASE IV;";
OleDbConnection c= new OleDbConnection(connStr);
c.open();
OleDbDataAdapter da=new OleDbDataAdapter("Select * from Table11",c);
DataSet ds=new Dataset();
da.Fill(ds);
c.Close();

From Excel "External table is not in the expected format."

"External table is not in the expected format." typically occurs when trying to use an Excel 2007 file with a connection string that uses: Microsoft.Jet.OLEDB.4.0 and Extended Properties=Excel 8.0

Upvotes: 1

Related Questions