Re: Sqlcommand object gives command timeout

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 06/22/04


Date: Tue, 22 Jun 2004 08:41:58 -0400

In addition to verifying that all of the connections are closed you may
want to do a few other things. There are two timeouts, Connectino Timeouts
and Command Timeouts. I think the problem is with the Connection and based
on the error message, this is probably it. I'd say definitely it but there
can be more than one thing wrong. Also, even on the command side, setting it
to 0 isn't reliable. You can only change the connection timeout via the
connection string but you may want to bump that up. As the others have
mentioned, verifying that the connections are closed and changing to pool
size are the first two things I'd do.

For testing purposes I often have needed to trap the State_Changed event of
the connection . I didn't really 'need' to do this, but I was convinced one
time that my connectinos were all closing and this helped me find out that
they weren't. I had a class library and down in the recesses of it, there
was a try/catch block eating the exception but the exception was fired
before close was getting called. The exception happened intermittently so
it obscured this - it was a tiny oversight code wise but it had pretty big
ramifications.

HTH,

Bill

-- 
W.G. Ryan, eMVP
http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
"M. Zeeshan Mustafa" <zeeshan@no-spm.please.zeeshan.net> wrote in message
news:eTib4NDWEHA.3016@tk2msftngp13.phx.gbl...
> Hi Yaseen,
>
> Try increasing Max Pool property of connection pooling, for
> reference see this link:
>
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlConnectionClassConnectionStringTopic.asp
>
> If you are using a data reader, its very important to close datareader
> and connection after you're done, if you dont, connection will
> go orphan!
>
> -- 
> Hope this helps,
> Zeeshan Mustafa, MCSD
>
>
> "Yaseen D M" <YaseenDM@discussions.microsoft.com> wrote in message
> news:852E6F2B-DE48-4CAC-BB20-41496AEB04C1@microsoft.com...
> > Hi,
> >
> > Yes i am closing the connections. and in table i have 102 records but it
> brings 100 records from that table.
> >
> > Thank u
> > Yaseen
> >
> > "Miha Markic [MVP C#]" wrote:
> >
> > > Hi Yaseen,
> > >
> > > This error normally occurs when you are not closing connections.
> > > Do you?
> > >
> > > -- 
> > > Miha Markic [MVP C#] - RightHand .NET consulting & development
> > > miha at rthand com
> > > www.rthand.com
> > >
> > > "Yaseen D M" <Yaseen D M@discussions.microsoft.com> wrote in message
> > > news:3B55599F-192B-4E98-B41B-99967C8B39FC@microsoft.com...
> > > > Hi,
> > > >
> > > > I am using sqlcommand object to execute a stored procedure. And i
> populate
> > > a dataset fro sqldataadapter. When i run it for the first time it
works
> fine
> > > when try to go to the next page it gives the following error
> > > >
> > > > Error Message :Timeout expired.  The timeout period elapsed prior to
> > > obtaining a connection from the pool.  This may have occurred because
> all
> > > pooled connections were in use and max pool size was reached.
> > > >
> > > > i tried giving commandtimeout=0 and also increased the timeout
period
> but
> > > still it doesnot work
> > > >
> > > > Give me a solution..
> > > >
> > > > Regards
> > > > Yaseen
> > >
> > >
> > >
>
>
>


Relevant Pages

  • Re: Close and Dispose argument
    ... > fact that even Microsoft is not clear on the issue. ... > connections from the pool is still a debate. ... > method removes the conneciton from the connection pool". ... > Your issue was forwarded to us here at Microsoft Courseware Support. ...
    (microsoft.public.dotnet.framework.adonet)
  • Close and Dispose argument
    ... here is an email conversation between me and Microsoft ... connections from the pool is still a debate. ... Programming with Microsoft ADO.NET" module 2, p 18: "Calling the Dispose ... method removes the conneciton from the connection pool". ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: MinPoolSize behaviour
    ... Min Pool Size, The first time you open a connection we will open the 1 ... > Is the pool created forever? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Q:Multithreaded ADO.Net Connections Are Non Pooled?
    ... different you get a new pool. ... > the process/app domain differences, does running on a thread created by ... If you're using SSPI, each connection must be ... >> connect to the SQL Server machine, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Problems with Media Center and Xbox 360
    ... are you able to connect to Xbox Live from your Xbox ... connection because the xbox wouldnt reconnect ... 6:56:13 AM: Verifying user is Administrator. ... 6:56:22 AM: Saving Media Discovery folders. ...
    (microsoft.public.windows.mediacenter)