找不到可安装的ISAM?
操作Excel连接字符串
string mystring = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source= " + excelf + "; Extended Properties=Excel 8.0 ";
OleDbConnection cnnxls =new OleDbConnection(mystring);
OleDbDataAdapter myDa =new OleDbDataAdapter( "select * from [Sheet1$] ",cnnxls);
DataSet myDs =new DataSet();
myDa.Fill(myDs);
其中excelf是本地excel表所在的物理路径. 在网上查了下都是说data source中间空格导致.我看了半天没看出问题。怎么调试都过不了提示:找不到可安装的ISAM。郁闷起了
------解决方案--------------------
你试一下如下的这个好使吗?
string.Format( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties= 'Excel 8.0;Imex=2;HDR=Yes; ' ", m_FileName);
------解决方案--------------------
试试这个!
string mystring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= ' " + Path + " ';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1 '; ";
OleDbConnection cnnxls =new OleDbConnection(mystring);
OleDbDataAdapter myDa =new OleDbDataAdapter( "select * from [Sheet1$] ",cnnxls);
DataSet myDs =new DataSet();
myDa.Fill(myDs);