Elango Sengottaiyan
Elango Sengottaiyan

Reputation: 176

Default Timeout Period in SQL Server

I got the error

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

during the command execution.

I also set Connect Timeout=60 in the connection string.

That stored procedure execution time is around 35 seconds.

Connection is established, but result is not returned.

Upvotes: 1

Views: 18311

Answers (2)

VoonArt
VoonArt

Reputation: 904

You can also extend connection timeout in connectionstring

;Connection Timeout=30

See: Connection timeout for SQL server

Upvotes: 0

Marc Gravell
Marc Gravell

Reputation: 1062512

DbCommand has CommandTimeout, which is what you want here - it is set per command; the "connect timeout" only impacts, reasonably enough, what the timeout is for connecting. The default value for CommandTimeout on SqlCommand is 30 seconds.

Upvotes: 9

Related Questions