我收到错误“无法找到可安装的ISAM” 当我尝试使用OLEDB连接字符串读取csv文件时。
请协助
我的代码是:
if (File .Exists(openFileDialog1 .FileName ))
{
ConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+openFileDialog1.FileName +";Extended Properties=text;HDR=Yes;FMT=Delimited");
Con = new OleDbConnection(ConnectionString);
string query = "Select * From [Sheet1$]";
Con.Open();
DataAdapter = new OleDbDataAdapter(query, Con);
dt = new DataTable();
DataAdapter.Fill(dt);
dataGridView1.DataSource = dt;
}
答案 0 :(得分:5)
“当连接字符串的语法不正确时,也会生成此错误。” - msdn
当我试图复制你的连接字符串时,似乎很喜欢那里有很多空格。
ConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+openFileDialog1.FileName +";Extended Properties=text;HDR=Yes;FMT=Delimited");
如果这似乎无法解决您的问题,建议您查看this
答案 1 :(得分:3)
你可能在64位运行。 Oledb.4.0仅适用于32位应用程序