vote up 0 vote down
star

Good day,

I'm using a SQLDataSource with a dynamic query generated c#, based on user choices in many fields. However, since our tables are very large, sometimes, I get a command timeout exception.

I tried to set the property in 'Selecting' of the SqlDataSource like so:

protected void SqlDataSource_PSearch_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    e.Command.CommandTimeout = 900;            
}

but with not luck, like if this attribute was ignored.

.NET 2.0, Sql server 2005.

Any idea?

flag
add comment

1 Answer

vote up 0 vote down

I'm not very familiar with SqlDataSource, but the documentation for CommandTimeout mentions two possibilities:

  • The CommandTimeout property will be ignored during asynchronous method calls such as BeginExecuteReader.

  • CommandTimeout has no effect when the command is executed against a context connection (a SqlConnection opened with "context connection=true" in the connection string).

Are you using AJAX? That may cause an asynchronous method call.

link|flag
No, I'm not using ajax, nor context "connection=true" in the connection string – Cedric Aube Mar 17 at 17:01
add comment

Your Answer

Get an OpenID
or

Not the answer you're looking for? Browse other questions tagged or ask your own question.