产生错误程序如下
private bool readdbf(ref DataSet ds,ref string tableName)
{//读DBF
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = this.openFileDialog1.FileName;
string filePath = fileName.Substring(0, fileName.LastIndexOf("\\"));
tableName = fileName.Substring(fileName.LastIndexOf("\\") + 1);
tableName = tableName.Substring(0, tableName.LastIndexOf("."));
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=dBASE IV;User ID=;Password=;";
OleDbConnection oledbconnection = new OleDbConnection(connString);
OleDbDataAdapter oledbdataadapter = new OleDbDataAdapter("select * from " + tableName, oledbconnection);
try
{
oledbdataadapter.Fill(ds, tableName);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
return true;
}
else
{
return false;
}
}
本机可以运行。
测试机运行时产生错误“外部表不是预期表格式”
测试机系统window XP SP2
jet 4.0 已经升级到SP8以上版本
MDAC2.8 安装时出现“所有功能已经安装”的提示请问各位老大,我测试机上还应该安装什么环境才能运行程序(补充:本机上使用ACCESS 2003 可以打开dbf文件,但是测试机上同样版本的ACCESS确不能打开dbf文件,出现的错误同样是“外部表不是预期表格式”,不知道是不是巧合,还是2个问题之间有一定联系。)请各位老大指点
private bool readdbf(ref DataSet ds,ref string tableName)
{//读DBF
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string fileName = this.openFileDialog1.FileName;
string filePath = fileName.Substring(0, fileName.LastIndexOf("\\"));
tableName = fileName.Substring(fileName.LastIndexOf("\\") + 1);
tableName = tableName.Substring(0, tableName.LastIndexOf("."));
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=dBASE IV;User ID=;Password=;";
OleDbConnection oledbconnection = new OleDbConnection(connString);
OleDbDataAdapter oledbdataadapter = new OleDbDataAdapter("select * from " + tableName, oledbconnection);
try
{
oledbdataadapter.Fill(ds, tableName);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
return true;
}
else
{
return false;
}
}
本机可以运行。
测试机运行时产生错误“外部表不是预期表格式”
测试机系统window XP SP2
jet 4.0 已经升级到SP8以上版本
MDAC2.8 安装时出现“所有功能已经安装”的提示请问各位老大,我测试机上还应该安装什么环境才能运行程序(补充:本机上使用ACCESS 2003 可以打开dbf文件,但是测试机上同样版本的ACCESS确不能打开dbf文件,出现的错误同样是“外部表不是预期表格式”,不知道是不是巧合,还是2个问题之间有一定联系。)请各位老大指点
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货