private void readXLSData()
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\nsharifzadeh\\Desktop\\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""");
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from [Sheet1$]", con);
DataSet ds = new DataSet();
da.Fill(ds);
}
我使用了调试器,它似乎一直在工作,da.Fill(ds)
然后它炸弹说:
*The Microsoft Jet database engine could not find the object 'Sheet1$'. Make sure the object exists and that you spell its name and the path name correctly.*
我发誓工作表的名称是 Sheet1!我在这里做错什么了吗?
谢谢你的帮助!