ODBC读取文件报错
ODBC读取dbf文件,当文件名字超过8个字符串时报错:[ODBC dBase驱动程序] Microsoft Jet数据库引擎找不到对象'xxxxxxxxx'。
代码如下:
DataSet ds=new DataSet();
using(OdbcConnection oConn=new OdbcConnection("Driver={Microsoft dBase Driver(*.dbf);DefaultDir=D:\\}"))
{
oConn.Open();
OdbcDataAdapter adpt=new OdbcDataAdapter("select * from xxx",oConn.ConnectionString);
adpt.Fill(ds);
oConn.Close();
}
到adpt.Fill(ds);这个位置报错,如果文件名少于8个字符串就不会报错。