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();
我试图从c#中读取.dbf表,我已经为它编写了上面的代码,但是我收到了这个错误:
外部表格未处于预期格式
答案 0 :(得分:0)
试试这个;
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();
来自Excel "External table is not in the expected format."
“外部表格不符合预期格式。”通常发生在 尝试使用带有以下连接字符串的Excel 2007文件: Microsoft.Jet.OLEDB.4.0和扩展属性= Excel 8.0
答案 1 :(得分:0)
static string connStr ="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Folder\sample.xlsx; Extended Properties=dBASE IV;";