Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / May 2005

Tip: Looking for answers? Try searching our database.

ConnectionState problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nick Gilbert - 24 May 2005 15:37 GMT
Hi,

My application connects to an Access database when it is loaded, and
keeps the same connection open all the time.

There is logic in the code to ensure that the connection is
automatically opened the first time it is used:

if ((cmd.Connection.State == ConnectionState.Closed) ||
(cmd.Connection.State == ConnectionState.Broken)) cmd.Connection.Open();

However occasionally my application says this:

System.InvalidOperationException:
    The connection is already Open (state=Connecting).

or it might say the same but with state=Executing.

But if the state is Executing, you can neither call .Open nor can you
execute a query. So how can I maintain an open connection without these
errors occuring?

To be honest, I don't understand why it is ever in the "Exectuting"
state, because it's a single threaded application and theres no way that
it can be doing more than one thing at once.

Thanks,

Nick...
Frans Bouma [C# MVP] - 25 May 2005 08:39 GMT
> Hi,
>
[quoted text clipped - 21 lines]
> state, because it's a single threaded application and theres no way that
> it can be doing more than one thing at once.

    This is a known issue with the JET driver.

    You could try to disable connection pooling in the connection string. See:
http://groups-beta.google.com/group/comp.database.ms-access/browse_frm/thread/b7
7eab8ff2d74574/3dc5aab454b373a8?q=%22The+connection+is+already+Open%22+Access&rn
um=1#3dc5aab454b373a8


        FB
       

Signature

------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.