N
Nick Gilbert
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...
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...