Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 830133 - Last Review: January 19, 2007 - Revision: 3.0
You receive an "unspecified error" error message when you create more than 64 connections to an Access Database in one process
On This Page
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:
- 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.
MORE INFORMATION
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 Codeusing System;
using System.Data.OleDb;
namespace AccessApplication
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[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 = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Program Files\\Microsoft Office\\Office10\\Samples\\Northwind.mdb;";
Console.WriteLine("Starting test...");
for (intCount=0;intCount<intMaxConnections;intCount++)
{
try
{
OleDbConnection myConnection = new OleDbConnection(strConnection);
myConnection.Open();
Console.WriteLine("Open connection is " + intCount);
objArray[intCount] = myConnection;
}
catch(Exception excpt)
{
Console.WriteLine("Exception : " + excpt.Message.ToString());
}
}
}
}
}
Visual Basic .NET CodeImports System.Data.OleDb
Module Module1
Sub Main()
Dim intCount As Integer
Dim intMaxConnections As Integer
Dim strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Program Files\Microsoft " _
& "Office\Office10\Samples\Northwind.mdb;"
intMaxConnections = 65
Dim IntArray(intMaxConnections) As Object
Console.WriteLine("Starting test...")
For intCount = 0 To intMaxConnections
Try
Dim objConnection As New OleDbConnection(strConnection)
objConnection.Open()
Console.WriteLine("Open connection is " & intCount)
IntArray(intCount) = objConnection
Catch excpt As Exception
Console.WriteLine("Exception " + excpt.Message.ToString())
End Try
Next
End Sub
End Module
- On the Debug menu, click
Start.
REFERENCES
For more information about how to open an Access database by
using ADO, visit the following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft Access 2002 Standard Edition
- Microsoft Access 2000 Standard Edition
- Microsoft Access 97 Standard Edition
| kberrmsg kbprb kbdatabase KB830133 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please