blah blah blah is here! blah blah » Close

up0down
link

I'm having a SQL timeout error during a SP call from C#.
I cannot find the place to adjust the time out period longer.
The error is "[SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]"
Any one who has any ideas, reply. THANKS

last answered 3 months ago

1 answers

up0down
link

There is a timeout parameter that you can set on the SqlCommand object.
SqlCommand sqlComm = new SqlCommand();
sqlComm.CommandTimeout = 60;
The timeout value is in seconds. The default is 30 seconds. Setting this parameter to 0 will result in no timeout.
Doug
Memphis, Tn

up0down
link

There's also second timout setting in the connection string of MS SQL Server connection...
"data source=ServerName;initial catalog=DataBaseName;uid=ID;pwd=Password;Connect Timeout=120"
...which will probably also need adjusting...

up0down
link

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx
"Connect Timeout=" and "Connection Timeout=" are the same, and are a time out for the connecting only, they are not related to execution times.

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback