SQLDatasource CommandTimeout not working

Posted by Cedric Aube on Stack Overflow See other posts from Stack Overflow or by Cedric Aube
Published on 2009-03-17T15:09:23Z Indexed on 2010/04/04 12:03 UTC
Read the original article Hit count: 620

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?

© Stack Overflow or respective owner

Related posts about sqldatasource

Related posts about .NET