|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connection getting closed in between.Hi all,
I am using sqlconnection in .net and opening connection at the begining of application and closing it at the end. But some time i am getting error. 'Invalid operation. The connection is closed.' can someone tell me reason behind this error. Please tell me as this is very very imp for me Thanks in advance. trialproduct2***@yahoo.com wrote:
> Hi all, Most likely, the reason is that you closed the connection. Without more > > I am using sqlconnection in .net and opening connection at the > begining of application and closing it at the end. > > But some time i am getting error. > 'Invalid operation. The connection is closed.' > > can someone tell me reason behind this error. > > Please tell me as this is very very imp for me details to go on, there's really not much more to say. -cd Hi,
Thanks for your reply. But i haven't closed connection in between. My app was working properly for nearly 15 days and then suddenly it is giving this problem. When i restarted my application everything is working properly. And i am not getting why this is happening. Because in class constructor i am opening connection and after performing all processing i am closing connection. So in between there is no code which is closing connection. So may be on sql server side connection is getting closed. But i don't know about that. So if you could help me in finding other way by which connection may be close, then it will be benefical for me. Thanks. Carl Daniel [VC++ MVP] wrote: Show quote > trialproduct2***@yahoo.com wrote: > > Hi all, > > > > I am using sqlconnection in .net and opening connection at the > > begining of application and closing it at the end. > > > > But some time i am getting error. > > 'Invalid operation. The connection is closed.' > > > > can someone tell me reason behind this error. > > > > Please tell me as this is very very imp for me > > Most likely, the reason is that you closed the connection. Without more > details to go on, there's really not much more to say. > > -cd trialproduct2***@yahoo.com wrote:
Show quote > Hi, You should change your design a bit so your program won't have to keep > > Thanks for your reply. > > But i haven't closed connection in between. My app was working properly > for nearly 15 days and then suddenly it is giving this problem. When i > restarted my application everything is working properly. > > And i am not getting why this is happening. Because in class > constructor i am opening connection and after performing all processing > i am closing connection. > > So in between there is no code which is closing connection. So may be > on sql server side connection is getting closed. But i don't know about > that. > > So if you could help me in finding other way by which connection may be > close, then it will be benefical for me. > > Thanks. > > Carl Daniel [VC++ MVP] wrote: >> trialproduct2***@yahoo.com wrote: >>> Hi all, >>> >>> I am using sqlconnection in .net and opening connection at the >>> begining of application and closing it at the end. >>> >>> But some time i am getting error. >>> 'Invalid operation. The connection is closed.' >>> >>> can someone tell me reason behind this error. >>> >>> Please tell me as this is very very imp for me >> Most likely, the reason is that you closed the connection. Without more >> details to go on, there's really not much more to say. >> >> -cd > the connection open for 15 days. Otherwise you'll have the problem every time the sql server or network is down. Hi,
thanks for your reply. Basically i have window service which is running at certain interval and every time after using connection, i am closing that connection and reopening it in next interval. Should i change this logic also?. Can you tell me main cause of this error? Thanks ..neter wrote: Show quote > trialproduct2***@yahoo.com wrote: > > Hi, > > > > Thanks for your reply. > > > > But i haven't closed connection in between. My app was working properly > > for nearly 15 days and then suddenly it is giving this problem. When i > > restarted my application everything is working properly. > > > > And i am not getting why this is happening. Because in class > > constructor i am opening connection and after performing all processing > > i am closing connection. > > > > So in between there is no code which is closing connection. So may be > > on sql server side connection is getting closed. But i don't know about > > that. > > > > So if you could help me in finding other way by which connection may be > > close, then it will be benefical for me. > > > > Thanks. > > > > Carl Daniel [VC++ MVP] wrote: > >> trialproduct2***@yahoo.com wrote: > >>> Hi all, > >>> > >>> I am using sqlconnection in .net and opening connection at the > >>> begining of application and closing it at the end. > >>> > >>> But some time i am getting error. > >>> 'Invalid operation. The connection is closed.' > >>> > >>> can someone tell me reason behind this error. > >>> > >>> Please tell me as this is very very imp for me > >> Most likely, the reason is that you closed the connection. Without more > >> details to go on, there's really not much more to say. > >> > >> -cd > > > You should change your design a bit so your program won't have to keep > the connection open for 15 days. Otherwise you'll have the problem every > time the sql server or network is down. |
|||||||||||||||||||||||