Re: Sqlcommand object gives command timeout
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 06/22/04
- Next message: Gerard van Dorth: "Concurrency violation (once more...)"
- Previous message: Kevin Yu [MSFT]: "Re: connection in connection pool with pooling=false"
- In reply to: M. Zeeshan Mustafa: "Re: Sqlcommand object gives command timeout"
- Next in thread: Frans Bouma [C# MVP]: "Re: Sqlcommand object gives command timeout"
- Messages sorted by: [ date ] [ thread ]
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 > > > > > > > > > > > >
- Next message: Gerard van Dorth: "Concurrency violation (once more...)"
- Previous message: Kevin Yu [MSFT]: "Re: connection in connection pool with pooling=false"
- In reply to: M. Zeeshan Mustafa: "Re: Sqlcommand object gives command timeout"
- Next in thread: Frans Bouma [C# MVP]: "Re: Sqlcommand object gives command timeout"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|