Microsoft KB Archive/830133

= You receive an &quot;unspecified error&quot; error message when you create more than 64 connections to an Access Database in one process =

Article ID: 830133

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition
 * Microsoft Access 2000 Standard Edition
 * Microsoft Access 97 Standard Edition

-



SYMPTOMS
If you connect to a Microsoft Access database and then you create more than 64 connections in one process, you may receive one of the following error messages:  In Microsoft Visual Studio .NET:

Unspecified error

 In Microsoft Visual Basic 6.0, if you use ActiveX Data Objects (ADO):

Runtime-Error '-2147467259 (80004005)': Unspecified Error





STATUS
This behavior is by design.



Steps to reproduce the behavior
 Start Visual Studio .NET. Use Microsoft Visual C# .NET or Microsoft Visual Basic .NET to create a new Console Application project. Name the project AccessApplication. By default, Class1.cs (in Visual C# .NET) or Module1.vb (in Visual Basic .NET) is created.  In Class1.cs or in Module1.vb, replace the existing code with following code.

Note To use this sample code, change the Data Source path to the path of any Microsoft Access database file that is on your computer.

Visual C# .NET Code using System; using System.Data.OleDb;

namespace AccessApplication {   ///     /// Summary description for Class1. ///  class Class1 {   ///     /// The main entry point for the application. ///    [STAThread] static void Main(string[] args) {     //      // TODO: Add code to start application here //     int intCount; int intMaxConnections; string strConnection;

intMaxConnections = 65; object[] objArray = new object[intMaxConnections];

strConnection = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; + &quot;Data Source=C:\\Program Files\\Microsoft Office\\Office10\\Samples\\Northwind.mdb;&quot;; Console.WriteLine(&quot;Starting test...&quot;); for (intCount=0;intCount<intMaxConnections;intCount++) {       try {         OleDbConnection myConnection = new OleDbConnection(strConnection); myConnection.Open; Console.WriteLine(&quot;Open connection is &quot; + intCount); objArray[intCount] = myConnection; }       catch(Exception excpt) {         Console.WriteLine(&quot;Exception : &quot; + excpt.Message.ToString); }     }    }          } }  Visual Basic .NET Code Imports System.Data.OleDb Module Module1

Sub Main Dim intCount As Integer Dim intMaxConnections As Integer Dim strConnection = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; _ & &quot;Data Source=C:\Program Files\Microsoft &quot; _ & &quot;Office\Office10\Samples\Northwind.mdb;&quot;

intMaxConnections = 65

Dim IntArray(intMaxConnections) As Object Console.WriteLine(&quot;Starting test...&quot;) For intCount = 0 To intMaxConnections Try Dim objConnection As New OleDbConnection(strConnection) objConnection.Open Console.WriteLine(&quot;Open connection is &quot; & intCount) IntArray(intCount) = objConnection Catch excpt As Exception Console.WriteLine(&quot;Exception &quot; + excpt.Message.ToString) End Try Next End Sub

End Module  On the Debug menu, click Start.</li></ol>

<div class="references_section">