Time out expired

G

Guest

Hi,

i have a table data of 3 millions. When i try to populate the dataset from sqlcommand object or dataadapter it gives my following error

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

I checked iis the timeout is 20 mins i think its enough and i tried setting commandtimeout, but still its giving me same error


What is the solution?

Regards
Yaseen
 
M

M. Zeeshan Mustafa

Yaseen,

put this in your web.config, and it will increase your script time out to
900 seconds.

<system.web>
<httpRuntime executionTimeout="900" />
</system.web>

--
Hope this helps,
Zeeshan Mustafa, MCSD


Yaseen D M said:
Hi,

i have a table data of 3 millions. When i try to populate the dataset from
sqlcommand object or dataadapter it gives my following error
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

I checked iis the timeout is 20 mins i think its enough and i tried
setting commandtimeout, but still its giving me same error
 
W

Wells Caughey

Yaseen,

This timeout has nothing to do with IIS. It as has to do with the timeout
on your SqlCommand, which I think defaults to 30 seconds. You can either
extend this timeout through the timeout property on the command, or in the
connection string, but I suggest that if you are getting sqlcommand timeouts
while returning 3 million rows, that you might want to rethink your strategy
and retreive a much smaller sampling of you data.

Wells

Yaseen D M said:
Hi,

i have a table data of 3 millions. When i try to populate the dataset from
sqlcommand object or dataadapter it gives my following error
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

I checked iis the timeout is 20 mins i think its enough and i tried
setting commandtimeout, but still its giving me same error
 
W

William Ryan eMVP

Remeber that there's both a Command Timeout and a Connection Timeout. Based
on your other post (unless this is a different issue), you may be having one
or both problems. 3 million records in a query is absurd in the context you
are doing this. Even if you fix that, you are headed for disaster.
Remember that this all gets cached locally if you are using a datatable (and
even if you're using a Reader it's still nuts). You can't possibly need 3
million records in one page view. Anything else you do is simply going to
be cosmetic. It may 'fix' it, but attack the source of them . Even if you
need 3 million in a session, page or something but there are better
strategies than this. Or just turn up the timeout to about 3 hours.

HTH,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
Yaseen D M said:
Hi,

i have a table data of 3 millions. When i try to populate the dataset from
sqlcommand object or dataadapter it gives my following error
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding. at
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

I checked iis the timeout is 20 mins i think its enough and i tried
setting commandtimeout, but still its giving me same error
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top