System.Data.OleDb.OleDbException: Unspecified errorhttp://forums.asp.net/t/314899.aspx/1?System+Data+OleDb+OleDbException+Unspecified+errorMon, 08 Nov 2010 03:19:37 -0500314899314899http://forums.asp.net/p/314899/314899.aspx/1?System+Data+OleDb+OleDbException+Unspecified+errorSystem.Data.OleDb.OleDbException: Unspecified error I developed a webapplication using winxp and visual studio 2004. I deployed it on a server running win2k server. they both are using v.1.4322.573 When I try to use a part of the app that reads and excel file into a datagrid, and exception is thrown with the following info. <pre class="prettyprint">Server Error in '/MR' Application. -------------------------------------------------------------------------------- Unspecified error Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Unspecified error Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [OleDbException (0x80004005): Unspecified error] System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) &#43;20 System.Data.OleDb.OleDbConnection.InitializeProvider() &#43;57 System.Data.OleDb.OleDbConnection.Open() &#43;203 System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState&amp; originalState) &#43;44 System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) &#43;304 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) &#43;77 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) &#43;38 VendorDatabase.excelHandler.excelToDatagrid(String filepath, String importType) in c:\inetpub\wwwroot\VendorDatabase\excelHandler.vb:31 VendorDatabase.WebForm1.btnImportFileImport_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\VendorDatabase\WebForm1.aspx.vb:781 System.Web.UI.WebControls.Button.OnClick(EventArgs e) &#43;108 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) &#43;57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) &#43;18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) &#43;33 System.Web.UI.Page.ProcessRequestMain() &#43;1277 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573</pre> this is the code where it fails <pre class="prettyprint"> Function excelToDatagrid(ByVal filepath As String, ByVal importType As String) As DataSet Dim strConn As String Dim myCommand As OleDb.OleDbDataAdapter Dim conn As OleDb.OleDbConnection Dim mydataset As DataSet strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + filepath + ";" + "Extended Properties=Excel 8.0;Persist Security Info=False;" conn = New OleDb.OleDbConnection(strConn) myCommand = New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1&#36;]", strConn) mydataset = New DataSet myCommand.Fill(mydataset) myCommand.Dispose() Return mydataset End Function </pre> 2003-08-20T22:50:08-04:00760616http://forums.asp.net/p/314899/760616.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error i got the same thing too.. can some help? System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbConnectionInternal.InitializeProvider() at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnection conn, OleDbConnectionString constr) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object providerInfo, DbConnectionBase owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnectionBase owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnectionBase owningConnection) at System.Data.ProviderBase.DbConnectionClosed.Open(DbConnectionBase outerConnection) at System.Data.ProviderBase.DbConnectionBase.Open() at ASP.excel1_aspx.LoadExcelIntoDS() in c:\excel_dev\excel1.aspx:line 25 &lt;script runat=server&gt; void Page_Load(Object src, EventArgs e) { LoadExcelIntoDS(); } void LoadExcelIntoDS() { OleDbConnection MyConnection = new OleDbConnection(); try { String conn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot;; conn &#43;= @&quot;Data Source=C:\excel_dev\demo_banc.xls;&quot;; conn &#43;= &quot;Extended Properties=Excel 8.0;&quot;; MyConnection = new OleDbConnection(conn); MyConnection.Open(); } catch(ArgumentException ae) { Response.Write(ae.ToString() &#43; &quot;<br> &quot;); } catch(OleDbException e) { String err_msg = &quot;&quot;; for (int i = 0; i &lt; e.Errors.Count; i&#43;&#43;) err_msg &#43;= &quot;----------------<br> Index #&quot; &#43; i &#43; &quot;<br> Message: &quot; &#43; e.Errors[i].Message &#43; &quot;<br> NativeError: &quot; &#43; e.Errors[i].NativeError &#43; &quot;<br> Source: &quot; &#43; e.Errors[i].Source &#43; &quot;<br> SQLState: &quot; &#43; e.Errors[i].SQLState &#43; &quot;<br> &quot;; Response.Write(err_msg &#43; &quot;<br> &quot;); Response.Write(e.ToString() &#43; &quot;<br> &quot;); } catch(Exception e) { Response.Write(e.ToString() &#43; &quot;<br> &quot;); } finally { MyConnection.Close(); } } 2004-11-30T22:51:57-05:00760765http://forums.asp.net/p/314899/760765.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error Is there a reason for the &quot;@&quot; symbol in your connection string? However, the code seems to work in principle. Does the ASP application have read permissions over the folder that the file is in? If you step through the code in debug mode, can you see where the error is thrown? I'm puzzled as to why it does not seem to be making use of the code in the catch statements, especially as you are catching generic exceptions. What code is at line 25? 2004-12-01T03:40:20-05:00761714http://forums.asp.net/p/314899/761714.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error Sorry, I recall now that '@' is used to escape a string in C#. 2004-12-01T21:08:05-05:00773631http://forums.asp.net/p/314899/773631.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error solved. this has to do with impersonation. in web.config, i set impersonate back to false and it works. i read in another article on this forum that because when .net reads an excel file, it creats a temp folder to store the data, and that temp folder can only be access by the ASPNET account. so if you impersonate as another user on the computer / network and tried to use ASPNET to read the data in the excel file, you will not be able to. 2004-12-14T20:07:26-05:001099054http://forums.asp.net/p/314899/1099054.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>i think the point here is that the asp.net user are not able to create files<br> in the temporary folder!<br> you can go to the temp folder ( ex. Document settings\servername\aspnet\)<br> and there on the temp folder give the full right access for the asp.net<br> user. i hope this may solve the problem<br> <br> Gursoy DURMUS<br> Turkiye</p> 2005-11-01T09:02:02-05:001694118http://forums.asp.net/p/314899/1694118.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>The scripts that access databases were working fine until I had to delete the wwwroot folder and recreate it, copying the files back in again.&nbsp; When I copied the files back in the SQL database didn't work. After a lot of hunting about I fixed that, but now whenver a script tries to access an Access database I get the </p> <p><span></p> <h2>&nbsp;<i>Unspecified error</i> </h2> </span><font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "><b>Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. <br> <br> <b>Exception Details: </b>System.Data.OleDb.OleDbException: Unspecified error</font> <p></p> <p>&nbsp;message appearing.&nbsp; I can't get rid of it, I've made sure aspnet can read/write/modify the database files and the containing directory.&nbsp; I've also done the above and gone to Documents and Settings\FRED\aspnet\ - there is no Temp folder so I created one and gave aspnet the permissions nescessary.&nbsp; I also gave it permissions on the Temp folder in Documents and Settings\FRED\aspnet\Local Setttings, but this didn't help either.</p> <p>I'm at a complete loss! Help!!<br> &nbsp;</p> 2007-05-03T23:04:09-04:001694127http://forums.asp.net/p/314899/1694127.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>Never mind - I eventually came across this: http://support.microsoft.com/kb/827190<br> <br> Changing (actually inserting) the &lt;identity impersonate=&quot;false&quot; /&gt; has fixed it.</p> It must have happened when I merged the two web.config files from the part I'm writing with the part my colleague did.&nbsp; Of all the useful error messages in the world....!<br> <p>&nbsp;</p> 2007-05-03T23:10:10-04:001813589http://forums.asp.net/p/314899/1813589.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>&quot;Document settings\servername\aspnet&quot;</p> <p>In my Documents and Settings folder, i can't see any servername folder, only user folder, where i can find ASPNET folder in my win 2003 system&nbsp;[Angel] ?</p> <p>Thanks !</p> 2007-07-20T00:18:20-04:001978478http://forums.asp.net/p/314899/1978478.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>&nbsp;May be your folder is hidden</p> <p>&nbsp;</p> <p>goto tools-&gt;folder options -&gt;view-&gt;hidden files and folders-&gt;enable show<br> </p> 2007-10-29T07:11:37-04:002381652http://forums.asp.net/p/314899/2381652.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>I have same error. please help me.</p> 2008-05-27T02:19:34-04:002411591http://forums.asp.net/p/314899/2411591.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>I'm having a similar issue, but with Excel in C#.</p> <p>&nbsp;The Excel file uploads just fine and is saved locally in a temp subfolder of the page.</p> <p>&nbsp;On Friday, my code was working just fine, but come Monday morning I'm now receiving this error on the &quot;dataAdapter.Fill(dataset)&quot; every time I try to read Excel into a dataset using the following, though nothing has changed.</p> <font color="#0000ff" size="1"><font color="#0000ff" size="1">public</font></font><font size="1"> </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">DataSet</font></font><font size="1"> ExcelRead(</font><font color="#0000ff" size="1"><font color="#0000ff" size="1">string</font></font><font size="1"> ExcelFilePath, </font><font color="#0000ff" size="1"><font color="#0000ff" size="1">string</font></font><font size="1"> sheetName)</font><font size="1"> <p>{</p> <p></font><font color="#0000ff" size="1"><font color="#0000ff" size="1">string</font></font><font size="1"> connectionString = </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">String</font></font><font size="1">.Format(</font><font color="#a31515" size="1"><font color="#a31515" size="1">@&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=&quot;&quot;Excel 8.0;HDR=YES;IMEX=1&quot;&quot;&quot;</font></font><font size="1">, ExcelFilePath);</font><font color="#008000" size="1"><font color="#008000" size="1"></p> </font></font><font size="1"></font><font color="#0000ff" size="1"><font color="#0000ff" size="1">string</font></font><font size="1"> query = </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">String</font></font><font size="1">.Format(</font><font color="#a31515" size="1"><font color="#a31515" size="1">&quot;SELECT * FROM [{0}&#36;]&quot;</font></font><font size="1">, sheetName);</font><font size="1"> <p></font><font color="#2b91af" size="1"><font color="#2b91af" size="1">OleDbDataAdapter</font></font><font size="1"> dataAdapter = </font><font color="#0000ff" size="1"><font color="#0000ff" size="1">new</font></font><font size="1"> </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">OleDbDataAdapter</font></font><font size="1">(query, connectionString);</p> </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">DataSet</font></font><font size="1"> dataSet = </font><font color="#0000ff" size="1"><font color="#0000ff" size="1">new</font></font><font size="1"> </font><font color="#2b91af" size="1"><font color="#2b91af" size="1">DataSet</font></font><font size="1">();</font><font size="1"> <p>dataAdapter.AcceptChangesDuringFill = </font><font color="#0000ff" size="1"><font color="#0000ff" size="1">true</font></font><font size="1">;</p> dataAdapter.Fill(dataSet);</font><font size="1"></font><font size="1"></font><font color="#0000ff" size="1"><font color="#0000ff" size="1">return</font></font><font size="1"> dataSet;</font><font size="1"> <p>}</p> <p><span class="Apple-style-span" style="">System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.OleDb.OleDbConnection.Open() at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)</span></p> <p>The Excel file is uploaded successfully to a temp subfolder.&nbsp; I'm not using impersonation, so&nbsp;I've tried granting full permissions to the temp folder for the local ASPNET account, even though it wasn't necessary before for this to work.</p> <p>&nbsp;</p> </font> 2008-06-09T19:00:41-04:003521985http://forums.asp.net/p/314899/3521985.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>Changing impersonation to false worked for me. I had it tested on&nbsp;development site; but on live site it failed. Thanks for your post.&nbsp;</p> 2009-11-19T12:43:55-05:003530111http://forums.asp.net/p/314899/3530111.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>My experience: </p> <p>In production servers the OleDb components loaded on ASP.NET worker process seems to&nbsp;missfunction ocassionally.&nbsp;Restarting the IIS the problem will go away.</p> <p>&nbsp;</p> 2009-11-24T12:48:04-05:003551893http://forums.asp.net/p/314899/3551893.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>I am having the same problem on server. 'hv tried with this but after some time its happening again. and w3wp.exe is taking more memory usage. please help.</p> <p>Thanks,<br> </p> 2009-12-07T12:17:40-05:004046801http://forums.asp.net/p/314899/4046801.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>I am still facing the same problem..pls help..</p> <p><br> </p> <p>- </p> <p>Vinay<br> </p> 2010-08-26T10:33:38-04:004158263http://forums.asp.net/p/314899/4158263.aspx/1?Re+System+Data+OleDb+OleDbException+Unspecified+errorRe: System.Data.OleDb.OleDbException: Unspecified error <p>I have the same problem.&nbsp; Users could upload the files to the server and open it with OLEDB connection.&nbsp; It works fine.&nbsp; But, after a period of time, it returns with 'unspecific error' on OLEDB connection.&nbsp; After restarting the IIS, it works fine again.&nbsp; But this errors seems happened frequently now.&nbsp; </p> <p>Could anyone help me to fix this 'Unspecific error'.</p> <p>Thank you very much!</p> <p>&nbsp;</p> 2010-11-08T03:19:37-05:00