Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with OleDbConnection, Excel and connection pooling
    primarykey
    data
    text
    <p>So, I have the same symptoms as described in <a href="https://stackoverflow.com/questions/472079/c-asp-net-oledb-ms-excel-read-unspecified-error/5621884">C#/ASP.NET Oledb - MS Excel read &quot;Unspecified error&quot;</a>, but my <a href="https://stackoverflow.com/questions/472079/c-asp-net-oledb-ms-excel-read-unspecified-error/5621884#5621884">my answer</a> did not seem to fix it. Even always closing the OleDBConnection and disposing of it show the same symptoms.</p> <pre><code>var connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0; data source={0}; Extended Properties=Excel 12.0;", _excelFile); using (var conn = new OleDbConnection(connectionString)) { try { DoSomething(); } finally { conn.Close(); } } </code></pre> <p>Now I have found the following info on connection pooling:</p> <blockquote> <p>The .NET Framework Data Provider for OLE DB automatically pools connections using OLE DB session pooling. Connection string arguments can be used to enable or disable OLE DB services including pooling. For example, the following connection string disables OLE DB session pooling and automatic transaction enlistment.</p> <p>Provider=SQLOLEDB;OLE DB Services=-4;Data Source=localhost;Integrated Security=SSPI;</p> <p>We recommend that you always close or dispose of a connection when you are finished using it in order to return the connection to the pool. Connections that are not explicitly closed may not get returned to the pool. For example, a connection that has gone out of scope but that has not been explicitly closed will only be returned to the connection pool if the maximum pool size has been reached and the connection is still valid.</p> </blockquote> <p>(Source: <a href="http://msdn.microsoft.com/en-us/library/ms254502.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms254502.aspx</a>)</p> <p>What is the connection string property <code>OLE DB SERVICES</code> and what is a value of <code>-4</code>?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload