怎样读取excel单元格数据
string table0 = textBox1.Text.Trim();
//string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ="+table0+";Extended Properties=Excel 8.0";
string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =" + table0 + ";Extended Properties=\"Excel 8.0; HDR = No;IMEX=1\"" ;
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM [sheet1$] ";
myConn.Open();
//打开数据链接,得到一个数据集
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
//创建一个 DataSet对象
//myDataSet = new DataSet();
DataSet myDataSet = new DataSet();
//得到自己的DataSet对象
myCommand.Fill(myDataSet, "[sheet1$]");
//数据绑定
string adf1=myDataSet .Tables ["sheet1$"].Rows[2][5].ToString();
这样读取不了数据,为什么?