ASP.NET Read Excel File
Posted on 2006-04-04
I get an "Unspecified Error" from "Microsoft JET Database Engine" when logged in as most users on the deployment server. When I log in (I am an enterprise admin) I do not get an error, but another user that is trying this gets the error. I then added the user to the ent admins group and had them log out of thier PC to ensure all IE instances were shut down, go back in and try again, and they still get the error so it does not appear to be permissions. I have tested to make sure SheetName is getting populated which it is, and the file does exist. The line that throws the error is "Call da.Fill(xldt)".
Dim xlcn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FileName & ";Extended Properties=""Excel 8.0;HDR=YES;""")
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM [" & SheetName & "$]", xlcn)
Dim xldt As New DataTable
Any idea what the deal is? The stack at the point the error occurs is below, and while I am not that great at reading the stack it looks to me that it is actually when trying to execute the statement and not on the open step that it is throwing the error.
Stack: at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)