SqlConnection and Static Properties

  • Thread starter Thread starter Kuba
  • Start date Start date
K

Kuba

Hi!

I have static class with static "Connection" (SqlConnection) property,

all of my SqlDataAdapters and SqlCommands objects using this property as
Connection parameter,
in my developer computers everything works fine, but my end users often
obtaining some Sql exceptions like General network error, ConnectionState is
closed

my question is, can i use static properties which contains open connection
to SqlServer?,
maybe my problem is refered with Garbage Collector?
this exceptions appears very randomly,

im using Framework 1.1 with MSDE SP3

tia
Kuba Gluszkiewicz
 
While it's possible to share a connection between functions, only one
function can use it at a time (until MARS in 2.0). If the connection is
broken for some reason, you will get "General Network Error" exceptions.
These or other exceptions will continue until the pool is flushed (until 2.0
when this is fixed).

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
William!

thanks for prompt answer,

i have registered ConnectionStateChanged handler, and if connection is
broken, than function automaticaly reopen this connection,

my app works in small local network, and i don't know why this connections
are broken?
maybe GC collects my connection? is it possible?

br
Kuba
 
Unfortunately, until ADO 2.0, the State property does not change if the
connection is lost to the server for some reason.

--
____________________________________
Bill Vaughn
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
my app works in small local network, and i don't know why this connections
are broken?
maybe GC collects my connection? is it possible?

No. Your problem is probably network related.
 
Back
Top