错误阅读使用asp.net的excel

在我的要求中,我成功打开和阅读Asp.net OLEDB的Excel(包括2003&07)数据。

但是,只有当Excel表格保持打开在我们的电脑 ,否则它会给'外部表格格式错误'。究竟是什么问题?可以任何人告诉我请轻。 这是访问权限的问题吗?

肯定它与连接string无关。 我的代码

protected void Page_Load(object sender, EventArgs e) { string path = @"C:\Users\abcd\Desktop\raj.xls"; connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + absoluteDir + ";Extended Properties=\"Excel 8.0;HDR=YES;\""; OleDbConnection oledbConn = new OleDbConnection(connStr); try { oledbConn.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM [Sheet1$]", oledbConn); OleDbDataAdapter oleda = new OleDbDataAdapter(); oleda.SelectCommand = cmd; DataSet ds = new DataSet(); oleda.Fill(ds); GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); } catch (Exception err) { } finally { // Close connection oledbConn.Close(); } } 

提前致谢

问题是访问问题,意味着表单被密码保护。